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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:19:50+00:00 2026-06-10T23:19:50+00:00

i have tabview with 4 tabs and i am using TabHost to display tabs

  • 0

i have tabview with 4 tabs and i am using TabHost to display tabs my application.
every tab is filled by another class extends from ListActivity and here is the code

public class TabbedActivity extends TabActivity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tab_layout);

    TabHost tabHost = getTabHost();

    // Tab for Catalog
    TabSpec catalogspec = tabHost.newTabSpec("Catalog");
    catalogspec.setIndicator("Complete Catalog Fall 2012", getResources().getDrawable(R.drawable.ic_catalog));
    Intent catalogIntent = new Intent(this, Category.class);
    catalogspec.setContent(catalogIntent);
// Adding all TabSpec to TabHost
    tabHost.addTab(catalogspec); // Adding catalog tab
}

and this the code at the other intent

public class Category extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {       
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_of_data);
 Categories = new ArrayList<String>();
    fillListCategories();

    myListItems = new ArrayList<String>();
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, Categories);
        this.setListAdapter(adapter);
}}

at the Listview there is list of items ,, my Point is how to set the Onclick to open another “ListActivity” in the same Tab ?!!

  • 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-10T23:19:52+00:00Added an answer on June 10, 2026 at 11:19 pm

    In your Category class, add an onClickListener like so:

    public class Category extends ListActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {       
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_of_data);
    Categories = new ArrayList<String>();
    fillListCategories();
    
    myListItems = new ArrayList<String>();
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,   Categories);
        this.setListAdapter(adapter);
        this.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick( AdapterView<?> parent, View item, 
                               int position, long id) {
        mSelectedCategory = (String)parent.getItemAtPosition(position);
    
        Intent intent = new Intent(getBaseContext(), ScreenTwo.class); 
                intent.putExtra("name", mSelectedCategory.(WHATEVER INFO YOU NEED ABOUT THE CATEGORY);
                startActivity(intent);  
      }
    });
    }}
    

    ScreenTwo.java would look like the category class with the ListAdapter but with the information that was passed through the intent:

    public class ScreenTwo extends ListActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {       
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_of_data);
    Bundle b = getIntent().getExtras(); 
        String Name = b.getString("name");
    Categories = new ArrayList<String>();
    fillListCategories();
    
    myListItems = new ArrayList<String>();
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,    Categories);
        this.setListAdapter(adapter);
    }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my android application, I am using the tab view and so I have
I have created a custom tabbar in my application (using TabHost and TabWidget ).
I currently have a tabview with 3 tabs. 1 tab loads an ActivityGroup which
I have a tab view which has a listview in one of these tabs.
I have one tabview which contain two different tab(subject and chapter) and i need
I have a flash app embedded in a yui TabView tab div, the problem
I am using jQuery UI 's tab view. I have included my HTML below,
have written this little class, which generates a UUID every time an object of
I have a Tabview with 3 tabs (each having their own activity). I have
I have a number of tabs and one is a search tab. When the

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.