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 7537457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:51:26+00:00 2026-05-30T06:51:26+00:00

Hi guyzz I have TabActivity as following simple code public class TabhostActivity extends Activity{

  • 0

Hi guyzz I have TabActivity as following simple code

public class TabhostActivity extends Activity{
    TabHost host;

    public class TabhostActivity extends Activity{
    TabHost host;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setContentView(R.layout.tablayout);

        host = (TabHost) findViewById(R.id.mytabhost);

        host.setup();
        Intent intent = new Intent(getApplicationContext(), RatingBarActivity.class); 
        TabHost.TabSpec spec = host.newTabSpec("positions").setIndicator("Positions",getResources().getDrawable(R.drawable.add)).setContent(intent);

        host.addTab(spec);
        host.setCurrentTab(0);

    }

and has a simple tab layout as

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TabHost
        android:id="@+id/mytabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:padding="5dp">

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" 
            android:padding="5dp">

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1" 
                android:background="#FF0000">

            </FrameLayout>

            <HorizontalScrollView
                android:id="@+id/horizontalScrollView1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >

                <TabWidget
                    android:layout_marginLeft="5dp"
                    android:id="@android:id/tabs"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:tabStripEnabled="true" >
                </TabWidget>
            </HorizontalScrollView>
        </LinearLayout>
    </TabHost>

</LinearLayout>

So please help me where the code is getting wrong?? I got exception as

02-23 14:09:47.920: E/AndroidRuntime(1000): Caused by: java.lang.IllegalStateException: Did you forget to call ‘public void setup(LocalActivityManager activityGroup)’?

  • 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-05-30T06:51:27+00:00Added an answer on May 30, 2026 at 6:51 am

    you are extending Activity class, try extending TabActivity class

    or

    if you want to use the Activity class then use the following :

    host = (TabHost) findViewById(R.id.tabhost); //here tabHost will be your Tabhost
        LocalActivityManager mLocalActivityManager = new LocalActivityManager(mActivity, false);
        mLocalActivityManager.dispatchCreate(state); // state will be bundle your activity state which you get in onCreate
        tabHost.setup(mLocalActivityManager);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would you guyz be so kind to help me with such question: I have
i am looking for code to validate html color codes. wanna check if user
I have 5 columns in my datagrid? I want to sort the datagrid in
I'm a PHP virgin (first day), so please type slowly. I have a number
I am trying to write a string concatenation code. I wonder what is wrong
i m a newbie... I need help with inser statement .. my code is
I have process which continuously downloads XML from the feed and saves it to
I have created a function which will convert any string into tab delimited. What's
I have migrated an app from a full-Hibernate featured one to a JPA/Hibernate based-one
On a glassfish server I have a JDBC Connection pool set up for my

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.