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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:47:39+00:00 2026-06-14T12:47:39+00:00

I have a support action bar that works fine if I trigger the event

  • 0

I have a support action bar that works fine if I trigger the event with an intent manually. But if I leave it up to the tabhost to call it then the actionbar returned from getSupportActionbar() is null.

I’ve heard this referenced on Stack in another question, but no one has supplied and answer. (Apparently it only occurs on Android 3 and above). Does anyone have any ideas?

My tabhost:

public class NavTab extends TabActivity {

    TabHost tabHost;

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

        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        // Initialize a TabSpec for each tab and add it to the TabHost
        intent = new Intent().setClass(this, SummaryPage.class);
        spec = tabHost.newTabSpec("Summary");
        spec.setIndicator("Account", getResources().getDrawable(R.drawable.tab_icon_summary));
        spec.setContent(intent);
        tabHost.addTab(spec);

        //Feedback
        intent = new Intent().setClass(this, FeedbackPage.class);
        spec = tabHost.newTabSpec("Feedback");
        spec.setIndicator("Feedback", getResources().getDrawable(R.drawable.tab_icon_summary));
        spec.setContent(intent);
        tabHost.addTab(spec);

        //Payment Locations
        intent = new Intent().setClass(this, PaymentLocationsActivity.class);
        spec = tabHost.newTabSpec("Payment Locations");
        spec.setIndicator("Pay Loc", getResources().getDrawable(R.drawable.tab_icon_summary));
        spec.setContent(intent);
        tabHost.addTab(spec);

        //Usage Alert
        intent = new Intent().setClass(this, UsageAlertPage.class);
        spec = tabHost.newTabSpec("Usage Alerts");
        spec.setIndicator("Alerts", getResources().getDrawable(R.drawable.tab_icon_summary));
        spec.setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(1);

    }


}

My activity

public class PageWithActionBar extends SherlockActivity implements ActionBar.OnNavigationListener {

    private static String TAG = "mymeter-Main";
    private List<Account> accounts = new LinkedList<Account>();
    private LocationAdapter locationAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);


        ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
        actionBar.setDisplayShowTitleEnabled(false);

        accounts.add(new Account("123456789", "4-15 Rose Rd", "Auckland 1021"));
        accounts.add(new Account("0987654321", "49 Ronaki Rd", "Auckland 1043"));
        locationAdapter = new LocationAdapter(this, accounts);
        actionBar.setListNavigationCallbacks(locationAdapter, this);


    }
}
  • 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-14T12:47:40+00:00Added an answer on June 14, 2026 at 12:47 pm

    Your TabActivity needs to extend SherlockActivity, check out the ActionBarSherlock samples on Tabs

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

Sidebar

Related Questions

Does emacs have support for big numbers that don't fit in integers? If it
I know that OpenCL doesn't have support for complex numbers, and by what I've
I have to support an application that was written in .NET 1.1 many years
Yet another compatibility problem from me. BACKGROUND I have an application that works in
I have a searchbar below the Action bar. It should be displayed above the
I am using viewpager with action-bar tab and I am have two fragment in
I have created a new android project. I want to have a action bar
I have a long running ASP response (actually an MVC action) that I want
I have an app using SlidingMenu, Action Bar Sherlock and now I am trying
Which browsers have support for CSS :before { content: x; }? I could not

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.