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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:28:39+00:00 2026-06-15T10:28:39+00:00

I have a small issue. I have looked all over the internet but I

  • 0

I have a small issue. I have looked all over the internet but I cannot find a solution to my problem. The problem I have is:

I have a TabHost that has 3 tabs. The first tab opens Activity A. In Activity A, I can press in a listview and it will change the setContent() to Activity B. When I press the back button in Activity B, the onBackPressed() function of Activity A gets called.

How can I close Activity B and go back to Activity A onBackPressed()?

  • 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-15T10:28:39+00:00Added an answer on June 15, 2026 at 10:28 am

    This is how i did it

    private void onBackPressed(){
        RootActivity parentActivity;
        parentActivity = (RootActivity) this.getParent();
        parentActivity.switchToSecondActivity();
    } // here RootActivity is the tabhost
    

    in RootActivity

    public void switchToSecondActivity(){
        tabHost.setCurrentTab(SECOND); 
    } //SECOND is an integer pointing location of the second activity. it starts from 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small issue where I am not able to find solution. My web
I have a small issue with a method that should save the text contained
I am just new to programming in Unix and have a small issue that
I'm building a MonoTouch iPhone app, but have come up with a small issue.
I have a small issue with forms that are created from inside a DLL.
I looked through all the similar questions that showed up before typing this, but
I have created several small applications that use my own DLL. The problem is,
I have looked for this issue on the internet and nothing specifies how to
I have small issue and that is I am now working with toggle button
i have an small issue with the way this problem is resolved. some would

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.