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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:48:10+00:00 2026-05-23T21:48:10+00:00

I have an app that has 2 tabs. Each tab loads an xml file

  • 0

I have an app that has 2 tabs. Each tab loads an xml file (fairly large, maybe 400 item rss file).

By default the tab doesn’t get the xml until it’s clicked on. I simply wanted a way to load it all when the app is first opened.

Here is the main view:

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

    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

    // Audio Feed
    intent = new Intent().setClass(this, AudioFeed.class);
    spec = tabHost.newTabSpec("audio").setIndicator("",
                      res.getDrawable(R.drawable.ic_tab_audio))
                  .setContent(intent);
    tabHost.addTab(spec);


    // Video Feed
    intent = new Intent().setClass(this, VideoFeed.class);
    spec = tabHost.newTabSpec("video").setIndicator("",
                      res.getDrawable(R.drawable.ic_tab_video))
                  .setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0); //todo: remember what tab user was last on
}
  • 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-23T21:48:11+00:00Added an answer on May 23, 2026 at 9:48 pm

    I use TabHost.setCurrentTab(x) or TabHost.setCurrentTabByTag(x).

    mTabHost.setCurrentTab(1);
    mTabHost.setCurrentTab(0);
    

    For Initialization I use TabHost.OnTabChangeListener.

    private OnTabChangeListener mOnTabChangeListener = new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tag) {
            if (FBIntent.EXTRA_XX.equals(tag)) {
                // Current tab is xx.
                ... if xx not init -> ...
            } else if (FBIntent.EXTRA_YY.equals(tag)) {
                // Current tab is yy.
                ...
            }
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iPhone app that has four tabs. On Tab 1 there is
My app has three tabs, A, B, C that have three distinct activities. Tab
I have an app that uses a tab bar controller. It has five tabs.
I have a UITabBarController that has 3 tabs. Each tab contains a UITableViewController. When
Have an app that has listings - think classified ads - and each listing
I have an app with a tab bar. Each tab has its own view
I have an iPhone app with a UITabBar, and each tab has a unique
I have an activity that has two tabs and a list view in each.
I have an app that has three tabs. They all do specific things. I
I have this app which consists of three tabs. The first tab has a

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.