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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:52:19+00:00 2026-05-25T09:52:19+00:00

Im in a process of learning android. Want to implement tabbed browsing functionality; For

  • 0

Im in a process of learning android.
Want to implement tabbed browsing functionality; For this purpose I have following activity

public class CustomList extends ListActivity {
....

and inside this (and other activities I want to put the tabs)

for example:
Resources res = getResources();

   **TabActivity ta = new TabActivity();**
        TabHost host = **ta.getTabHost();**  // this line returns **NullPointerException**

        host.addTab(host.newTabSpec("first")
                .setIndicator("First")
                .setContent(new Intent(this, First.class)));
These lines are included inside OnCreate().

Probably it would be better to have separate activity with tab definitions and just call it in every other activities. But, Im not sure how to do this.

Please for suggestion to solve this issue. Thank you in advance.

  • 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-25T09:52:19+00:00Added an answer on May 25, 2026 at 9:52 am

    I think what you want is to have multiple activity within a single tab.

    In order to do this, you have to first create an Activity which extend TabActivity, and initialize its tabs with activities extending TabGroupActivity.

    public class BaseActivity extends TabActivity {
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
    
      addTab("home",home_tab,tab_sales_icons,new Intent(this, TabGroupSalesActivity_.class));
      }
    }
    
    public class TabGroupSalesActivity extends TabGroupActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //Start the first Activity of the group
      Intent newIntent = new Intent(this, Sales_.class);
      newIntent.putExtra("XMLObject",xml);
      startChildActivity(newIntent);
      }
    }
    

    Here is a link with more informations on how to have multiple activities in a TabActivity

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

Sidebar

Related Questions

I'm in the process of learning Prolog. I have this recursive predicate: add(0,Y,Y). add(succ(X),Y,succ(Z))
I'm in the process of learning WPF coming from WinForms development. I have a
In the process of learning P/Invoke, I asked this previous question: How to P/Invoke
I'm in the process of learning about simulated annealing algorithms and have a few
In the process of learning WCF. To examplify, lets say I have 3 assemblies
In my ongoing learning process (dialog boxes this time), I discovered that this works:
In the process of learning Django and Python. I can't make sense of this.
I'm in the process of learning LINQ and would like some help the following
I am in the process of learning to unit test. I have a 'domain
I'm in the process of learning the android api. However, when I try to

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.