Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8294001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:02:34+00:00 2026-06-08T14:02:34+00:00

I am trying to create a swipping tab view using the ActionBar in Mono

  • 0

I am trying to create a swipping tab view using the ActionBar in Mono for Android.

The adroid for eclipse plugin has this as a default project template and I have manage to convert it over, I am now trying to add the functionally to separate my fragments out.

When I try to run my project I get a ClassNotFoundException

Here is the code for the Fragment

using Fragment = Android.Support.V4.App.Fragment;

namespace MobileCompanion.AndroidOS.App.UI.Customers
{
    public  class HomeTab : Fragment
    {
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup viewGroup, Android.OS.Bundle p2)
        {

            return null;
        }
    }
}

and here is my section adapter

using System.Collections.Generic;
using Android.Content;
using Android.OS;
using Android.Support.V4.App;
using Java.Lang;

namespace MobileCompanion.AndroidOS.App
{
    public class SectionsPagerAdapter : FragmentPagerAdapter
    {
        private readonly Context _context;
        public readonly IList<TabInfo> Tabs = new List<TabInfo>();
        private Bundle _bundle;

        public SectionsPagerAdapter(FragmentManager fm, Context context, Bundle savedInstanceState)
            : base(fm)
        {
            this._context = context;
            this._bundle = savedInstanceState;

        }

        public override Fragment GetItem(int i)
        {
            var args = new Bundle();
            var page = Fragment.Instantiate(this._context, typeof(HomeTab).FullName);
            //          var page = new HomeTab(); <<--- Work but nothing displayed as none of the create methods are run
            page.Arguments = args;
            return page;
        }

        public override int Count
        {
            get { return this.Tabs.Count; }
        }

        public override ICharSequence GetPageTitleFormatted(int p0)
        {
            return new String(this.Tabs[p0].PageTitle);
        }

    }
}

Java.Lang.RuntimeException: Unable to instantiate fragment
MobileCompanion.AndroidOS.App.UI.Customers.HomeTab: make sure class
name exists, is public, and has an empty constructor that is public
at Android.Runtime.JNIEnv.CallStaticObjectMethod
(intptr,intptr,Android.Runtime.JValue[]) [0x00024] in
/Users/builder/data/lanes/monodroid-mac-monodroid-4.2.4-branch/9f7cbd60/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:767

at Android.Support.V4.App.Fragment.Instantiate
(Android.Content.Context,string) [0x00034] in
/Users/builder/data/lanes/monodroid-mac-monodroid-4.2.4-branch/9f7cbd60/source/monodroid-bindings/Compatibility-v4/bindings/obj/platform-14/src/generated/Android.Support.V4.App.Fragment.cs:624

at MobileCompanion.AndroidOS.App.SectionsPagerAdapter.GetItem (int)
[0x00007] in
c:\Projects\MobileCompanion\trunk\MobileCompanion.Android.App\SectionsPagerAdapter.cs:28

at Android.Support.V4.App.FragmentPagerAdapter.n_GetItem_I
(intptr,intptr,int) [0x00008] in
/Users/builder/data/lanes/monodroid-mac-monodroid-4.2.4-branch/9f7cbd60/source/monodroid-bindings/Compatibility-v4/bindings/obj/platform-14/src/generated/Android.Support.V4.App.FragmentPagerAdapter.cs:56

at (wrapper dynamic-method)
object.780b3637-f853-4d6e-8435-9c92bc6a9dd5 (intptr,intptr,int)

— End of managed exception stack trace —

android.support.v4.app.Fragment$InstantiationException: Unable to
instantiate fragment
MobileCompanion.AndroidOS.App.UI.Customers.HomeTab: make sure class
name exists, is public, and has an empty constructor that is public

  at android.support.v4.app.Fragment.instantiate(Fragment.java:395)

  at android.support.v4.app.Fragment.instantiate(Fragment.java:363)

  at

mobilecompanion.androidos.app.SectionsPagerAdapter.n_getItem(Native
Method)

  at

mobilecompanion.androidos.app.SectionsPagerAdapter.getItem(SectionsPagerAdapter.java:30)

  at

android.support.v4.app.FragmentPagerAdapter.instantiateItem(FragmentPagerAdapter.java:97)

  at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:692)

  at android.support.v4.view.ViewPager.populate(ViewPager.java:821)

  at android.support.v4.view.ViewPager.populate(ViewPager.java:772)

  at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1234)

  at android.view.View.measure(View.java:12723)

  at

android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)

  at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)

  at android.view.View.measure(View.java:12723)

  at

android.widget.LinearLayout.measureVertical(LinearLayout.java:812)

  at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)

  at android.view.View.measure(View.java:12723)

  at

android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)

  at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)

  at

com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)

  at android.view.View.measure(View.java:12723)

  at

android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)

  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)

  at android.os.Handler.dispatchMessage(Handler.java:99)

  at android.os.Looper.loop(Looper.java:137)

  at android.app.ActivityThread.main(ActivityThread.java:4424)

  at java.lang.reflect.Method.invokeNative(Native Method)

  at java.lang.reflect.Method.invoke(Method.java:511)

  at

com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)

  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)

  at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.ClassNotFoundException:
MobileCompanion.AndroidOS.App.UI.Customers.HomeTab

  at

dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)

  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)

  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)

  at android.support.v4.app.Fragment.instantiate(Fragment.java:385)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:02:35+00:00Added an answer on June 8, 2026 at 2:02 pm

    The namespace must be all lowercase for Fragment.Instantiate to work. I believe this limitation is carried over from Java.

    var page = Fragment.Instantiate(_activity, typeof(T).Namespace.ToLower() + "." +  
                                    typeof(T).Name); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create or update default shipping address for a customer using
I'm trying to create a plot using pyplot that has a discontinuous x-axis. The
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
Trying to create a black line in my view to separate text blocks but
I'm trying to create two buttons that using the hover event, hide some divs
I am trying to create a custom pin code widget for android as an
Hi thanks for reading this! Please help me. I am trying to create a
I have a minor Problem. I'm trying to create a plugin to do some
I'm trying to create my own Magento shipping module in Magento 1.6. Since I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.