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

  • Home
  • SEARCH
  • 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 6023063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:56:59+00:00 2026-05-23T03:56:59+00:00

I have a TabActivity that is the base Activity in my application. From the

  • 0

I have a TabActivity that is the “base” Activity in my application. From the TabActivity a user can navigate through new Activities that are not a part of the original TabHost (I’m not messing around with TabGroups or anything like that).

My application also has a global options menu, from which a user should be able to navigate back to the original TabActivity and select a certain tab. For example, if the user selected the left-most options menu item, they would go to the left-most tab in the original TabActivity.

How can I accomplish this behavior? I do not want to start a new TabActivity because the original TabActivity has data propogated on it like Map points and a ListView. Ideally I would like to go back to that specific TabActivity. This movement can also occur at any point in the lifecycle, e.g.:

Original TabActivity -> Activity1 -> Activity2 -> Activity3 -> Activity n ->Back to Original TabActivity

Original TabActivity -> Activity1 -> Back to Original TabActivity

There can be any number of Activities launched in between the navigation. Therefore, calling finish() in the current Activity won’t satisfy this (as far as I know…).

My questions/concerns:

  1. Primarily, how to accomplish this.
  2. It is possible that the original TabActivity could be removed from the stack due to memory, correct? If so, how to deal with that? I assume if I figured out a way to locate the original TabActivity I could just do a check for null and if it’s not there, start a new TabActivity.
  • 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-23T03:57:00+00:00Added an answer on May 23, 2026 at 3:57 am

    Figured this out. You should use launchMode="singleTask" in your Manifest for the specific Activity that you wish to switch back to. According to the Dev docs this routes back to that specific Activity if it exists.

    So, in my Manifest, I have:

        <activity
            android:name=".MainTabsActivity"
            android:launchMode="singleTask"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar" >
        </activity>
    

    Then, in any Activity where you want to switch back to that TabActivity, just call a normal Intent. You can also use putExtra() to tell the TabActivity to switch to a new tab.

    In a sub Activity:

            Intent mainTabsSearchIntent = new Intent(this, MainTabsActivity.class);
            mainTabsSearchIntent.putExtra("tabval", 0);
            startActivity(mainTabsSearchIntent);
    

    This will either launch a new MainTabsActivity if the stack doesn’t have one or switch back to the old instance because of the launchMode="singleTask" parameter.

    In order to provide the tab switching functionality, override onNewIntent(Intent intent) in your main TabActivity like so:

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        Log.d(MyApplication.TAG, "Bringing this Activity back!");
    
        Bundle extras = intent.getExtras();
        if (extras != null) {
            tabHost.setCurrentTab(extras.getInt("tabval"));
            Log.d(MyApplication.TAG, "Switching to tab " + extras.getInt("tabval"));
        }
    }
    

    I hope this helps somebody that has a similar problem.

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

Sidebar

Related Questions

I have A TabActivity that hosts other activities, on the tabactivity I have a
I have a TabActivity that hosts other three activities. If the first tab is
i have an application that has a tabActivity and 3 tabs. all off the
I have a class that is already extending TabActivity so i can't extend ListActivity.
I have an android app that extends a MapActivity, so I can't extend TabActivity.
I have three activities: Activity A - Displays a list of data from a
I have a TabActivity that shows other Activities as the content based on which
My problem is, that I have got a TabActivity, which has 4 Tabs right
I have a normal notification system that looks like this: Notification notification new Notification(
I have a TabActivity with 3 tabs. There is an async task that when

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.