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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:13:44+00:00 2026-05-27T10:13:44+00:00

I have a listview withcin a activity and when someone clicks on an item

  • 0

I have a listview withcin a activity and when someone clicks
on an item in the listview I want to start a activity of type
TabActivity.

Any ideas on why it’s not working?

    list.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            JobListRowData item = jobListAdapter.getItem(position);
                Intent myIntent = new Intent(view.getContext(), EventsTabs.class);                  
                startActivity(myIntent);
            }  }    });


    public class EventsTabs extends TabActivity {
    private TabHost mTabHost;

    @Override 
    public void onCreate(Bundle savedInstanceState) {  
      setContentView(R.layout.event_main);
      Resources res = getResources(); 
      TabHost tabHost = getTabHost();  
      TabHost.TabSpec spec;  
      Intent intent;  
      intent = new Intent().setClass(this, EventsTabs.class);    
      spec = tabHost.newTabSpec("artists").setIndicator("Artists", res.getDrawable(R.drawable.icon)).setContent(intent);    
      tabHost.addTab(spec);    
      intent = new Intent().setClass(this, EventsTabs.class);    
      spec = tabHost.newTabSpec("albums").setIndicator("Albums",res.getDrawable(R.drawable.icon)).setContent(intent);
      tabHost.addTab(spec);    
      intent = new Intent().setClass(this, EventsTabs.class);    
      spec = tabHost.newTabSpec("songs").setIndicator("Songs", res.getDrawable(R.drawable.icon)).setContent(intent);
      tabHost.addTab(spec);    
      tabHost.setup(); 
     }  

    }

For some reason I get a :
12-06 13:37:47.607: ERROR/AndroidRuntime(346): Caused by: java.lang.IllegalStateException: Activities can’t be added until the containing group has been created.

  • 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-27T10:13:44+00:00Added an answer on May 27, 2026 at 10:13 am

    Try adding this to your code..

     LocalActivityManager mlam = new LocalActivityManager(this, false);
    
      mlam.dispatchCreate(savedInstanceState);
      tabHost.setup(mlam );
    

    EDIT: you should set up the tabhost before adding the tabs to it..

    You should call set up first like this…

    TabHost tabHost = getTabHost();  
      TabHost.TabSpec spec;  
       tabHost.setup(); //Move set up here
    
      Intent intent;  
      intent = new Intent().setClass(this, EventsTabs.class);    
      spec = tabHost.newTabSpec("artists").setIndicator("Artists", res.getDrawable(R.drawable.icon)).setContent(intent);    
      tabHost.addTab(spec);    
      intent = new Intent().setClass(this, EventsTabs.class);    
      spec = tabHost.newTabSpec("albums").setIndicator("Albums",res.getDrawable(R.drawable.icon)).setContent(intent);
      tabHost.addTab(spec);    
      intent = new Intent().setClass(this, EventsTabs.class);    
      spec = tabHost.newTabSpec("songs").setIndicator("Songs", res.getDrawable(R.drawable.icon)).setContent(intent);
      tabHost.addTab(spec);    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview with a DataTemplate that has a ComboBox. I want the
I have a listview where each item correlates to an instance of an item
I have a ListView which its contents could change at any time (eg. a
I have a listview within an activity and at the bottom of the screen
I have a listview where each list item can contain 1 or more clickable
I have an activity with a listview in it. I implemented a custom list
I have an activity with a listview that is displaying the results of a
I've have an ImageButton within a ListView . When a user clicks the button
I have a WPF ListView that I am trying to filter within a BackgroundWorker.
I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=> <td> <asp:LinkButton ID=UpdateButton

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.