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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:53:06+00:00 2026-06-11T14:53:06+00:00

My ActionBar tabs are disappearing when I start an activity from them. I can

  • 0

My ActionBar tabs are disappearing when I start an activity from them. I can see the Activity all right, but the tabs don’t appear.

My SherlockFragmentActivity is –

public class FragmentDemoActivity extends SherlockFragmentActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar bar = getSupportActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    ActionBar.Tab tab1 = bar.newTab();
    ActionBar.Tab tab2 = bar.newTab();

    tab1.setText("Fragment A");
    tab2.setText("Fragment B");

    tab1.setTabListener(new MyTabListener());
    tab2.setTabListener(new MyTabListener());
    bar.addTab(tab1);
    bar.addTab(tab2);
}

private class MyTabListener implements ActionBar.TabListener
{

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        if(tab.getPosition()==0)
        {
            CalendarViewActivity frag = new CalendarViewActivity();
            startActivity(new Intent(getApplicationContext(),CalendarViewActivity.class));
            //ft.replace(android.R.id.content, frag);

        }
        else
        {
            TestActivity frag = new TestActivity();
            //ft.replace(android.R.id.content, frag);
        }
    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft) {
        // TODO Auto-generated method stub

    }

}

}

While my Acitivity is a normal Android Activity –

public class CalendarViewActivity extends Activity

Any help please.

while my

  • 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-11T14:53:07+00:00Added an answer on June 11, 2026 at 2:53 pm

    I can see the Activity all right, but the tabs don’t appear.

    Of course not. You did not put any tabs on CalendarViewActivity, in part because CalendarViewActivity is just a regular Activity.

    If you are thinking that tapping on a tab should load something into FragmentDemoActivity, then you should not be calling startActivity() from your TabListener. Instead, you should be executing a FragmentTransaction or otherwise modifying the UI of FragmentDemoActivity.

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

Sidebar

Related Questions

I want to change default ActionBar tab's height, but can't find any info about.
Can I set the item on the top right of the ActionBar? While Android
Is there a way, how to delete actionbar (all his tabs and settings)? I'm
I couldn't find any info about this but, how can i programmatically switch tabs
In my main activity, I have an ActionBar with navigation tabs and action items.
I have an app that uses the ActionBar with tabs in combination with Fragments.
I am building an app that consists of actionbar with tabs, and each tab
I have a actionbar with a custom layout, but this show me the icon
Is there a native way to swipe/fling between different ActionBar tabs (the Honeycomb/ICS native
Using ActionBar Sherlock to implements tabs, I have a new TabsAdapter object declared and

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.