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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:09:07+00:00 2026-05-24T03:09:07+00:00

I have an app with a TabHost and three tabs. He is an example

  • 0

I have an app with a TabHost and three tabs. He is an example of how I am creating each tab:

    intent = new Intent().setClass(this, Setup.class); //intent.getClass()
    spec = tabHost.newTabSpec("setup").setIndicator("",
                    res.getDrawable(R.drawable.tab_setup))
                    .setContent(intent);
    tabHost.addTab(spec);

My goal is, when you switch to a new tab, to call a method updating the information displayed on that tab.

Here is the question: How does a tab know it has been displayed?

  • 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-24T03:09:07+00:00Added an answer on May 24, 2026 at 3:09 am

    Since you are using an Activity for each tab in your TabHost, you should use the Android lifecycle calls to update the information on your UI.

    onResume is called every time you switch to another tab’s Activity (onPause is then called in the last tab’s activity). This will keep your code in the proper place, in case you ever decide to use a different UI to host these activities.

    @Override
    public void onResume() {
        super.onResume();
        // Update your UI here.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having thoughts abut my current app. I have this TabHost class with two
I have a tabhost with some tabs, and each tab have implemented the method
I have an app that has 2 tabs. Each tab loads an xml file
I have an application with various tabs (on a tabhost), each tab is an
I have an app that uses a TabHost. Several of the Tabs share a
Here's my problem: I've have an application with tabs. in each tab I have
I have a class which extends Application in an Android tabHost app. In the
I have a TabHost activity as main activity of my app. This TabHost contains
I have an Android App that uses a TabHost layout. Every tab calls the
I have an Android app with 3 tabs in a TabHost (text labels, no

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.