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

  • SEARCH
  • Home
  • 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 9035369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:44:35+00:00 2026-06-16T08:44:35+00:00

I have an Activity that contains a ListView, and a TabHost. Inside this TabHost

  • 0

I have an Activity that contains a ListView, and a TabHost.
Inside this TabHost I’m trying to add another Activity and it keeps crashing on me.
Any idea what’s causing this?

public class MainActivity extends RoboFragmentActivity {

    @InjectView(R.id.listView)
    private ListView listView;
    @InjectView(R.id.tabHost)
    private TabHost tabHost;
    @Inject
    IIntentProxy intentProxy;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);

        tabHost.setup();

        TabHost.TabSpec spec = tabHost.newTabSpec("tag");
        spec.setContent(intentProxy.getIntent(DetailActivity.class));
        spec.setIndicator("Title");

                // It crashes on line below
                // tabHost is not null, neither is spec
        tabHost.addTab(spec);
    }

}

.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:weightSum="100" >

    <TabHost
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/tabHost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="50" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:padding="5dp" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >

                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:padding="5dp" >
                </FrameLayout>
            </TabWidget>
        </LinearLayout>
    </TabHost>

    <ListView
        android:id="@+id/listView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="50" >
    </ListView>

</LinearLayout>

Detail activity being added to tabhost
The xml file contains nothing, just a LinearLayout

public class DetailActivity extends RoboActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.detail_activity);
    }
}

Stacktrace

12-24 18:06:03.535: E/AndroidRuntime(27143): FATAL EXCEPTION: main
12-24 18:06:03.535: E/AndroidRuntime(27143): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.app/com.company.app.pages.MainActivity}: java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.os.Looper.loop(Looper.java:137)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.ActivityThread.main(ActivityThread.java:5039)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at java.lang.reflect.Method.invokeNative(Native Method)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at java.lang.reflect.Method.invoke(Method.java:511)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at dalvik.system.NativeStart.main(Native Method)
12-24 18:06:03.535: E/AndroidRuntime(27143): Caused by: java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:747)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.widget.TabHost.setCurrentTab(TabHost.java:413)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.widget.TabHost.addTab(TabHost.java:240)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at com.pages.ChargeSheetActivity.onCreate(ChargeSheetActivity.java:33)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.Activity.performCreate(Activity.java:5104)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-24 18:06:03.535: E/AndroidRuntime(27143):    at android.app.ActivityThread.performLaunchActivity(ActivityThr

ead.java:2144)
12-24 18:06:03.535: E/AndroidRuntime(27143): … 11 more

  • 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-16T08:44:36+00:00Added an answer on June 16, 2026 at 8:44 am

    1- I extended RoboTabActivity instead of RoboFragmentActivity

    2- Changed my xml from android:id="@+id/tabHost" to android:id="@android:id/tabhost"

    3- I added the activity to manifest file

    4- Instead of injecting the Tabhost or use findById I used this.getTabHost()

    Now the only question left is what if I need to use a DialogFragment? that usually requires the Activity to extend RoboFragmentActivity

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an activity that contains several user editable items (an EditText field, RatingBar,
I currently have a class called clientActivity that contains a finger paintig activity that
I have a workflow that contains a Pick activity. Each PickBranch is triggered by
I have an app that contains several activities...so lets say user is navigating activity
I have a service that also contains an activity the problem is sometimes it
My MAIN activity is spawning a child activity that contains a ListView . While
I developed an activity that contains canvas to draw image and I have a
I have a ListView that contains some data from sqllite table. the table is
I have a ListAdapter that contains a String array. When I click on any
I have a Fragment activity that contains 6 fragments. Every fragment is instance of

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.