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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:34:24+00:00 2026-06-02T18:34:24+00:00

I have four tabs in tabbar. Whenever I launch my application I need to

  • 0

I have four tabs in tabbar. Whenever I launch my application I need to run all the tabs (four) of a tabbar, because all the tabs contains webviews that should be loaded whenever the app is launched. But the first tab should gets highlighted. I have used

setCurrentTab(0); 

to load the first tab,but iam unable to load remaining tabs without clicking.

  • 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-02T18:34:26+00:00Added an answer on June 2, 2026 at 6:34 pm

    To do this, first create a xml file. The sample file is shown as below.

    <?xml version="1.0" encoding="utf-8"?>
    <TabHost android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:id="@android:id/tabhost"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="@drawable/background">
        <TabWidget android:layout_width="fill_parent" android:id="@android:id/tabs"
            android:layout_height="wrap_content" />
        <FrameLayout android:layout_width="fill_parent" android:id="@android:id/tabcontent"
            android:layout_gravity="bottom" android:paddingTop="70dp"
            android:layout_height="match_parent">
    
        <ScrollView android:layout_height="fill_parent" android:id="@+id/viewTab1"
            android:layout_width="match_parent">
            <!-- Your view you want -->
    
        </ScrollView>
        <LinearLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:id="@+id/viewTab2">
            <!-- Your view you want -->
    
        </LinearLayout>
    
        <!-- Add as many view you want with unique id -->
    </FrameLayout>
    

    Each layout will refer to a unique layout.

    In main activity use following

    TabHost tabHost = getTabHost(); 
    TabSpec spec1 = tabHost.newTabSpec("FirstTabView");
    TabSpec spec2 = tabHost.newTabSpec("SecondTabView");
    
    spec1.setContent(R.id.viewTab1);
    spec1.setIndicator("First Tab");
    
    spec2.setIndicator("Second Tab");
    spec2.setContent(R.id.viewTab2);
    
    tabHost.addTab(spec1);
    tabHost.addTab(spec2);
    
    tabHost.setup();
    

    You can add as many tabs needed. And this all will be initialized at same time.

    I hope this helps you 🙂

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

Sidebar

Related Questions

I have an TabBar application with 4 tabs. All four tabs have navigation controllers.
In my application I have a tab bar. It contains four tabs in which
I have an tabbar-application with four tabs. Every tab loades an nib with its
I am using tab host(tabs) in application, it have four tabs on home screen,
I have an iPhone app that has four tabs. On Tab 1 there is
I have a TabControl that has four tabs: <TabControl> <TabItem><TextBox/></TabItem> <TabItem><UserControl/></TabItem> <TabItem><Label/></TabItem> <TabItem><Image/></TabItem> </TabControl>
I've created a tab bar application. I have four tabs; on the selected tab,
I have four tabs that hold four listviews, I want to set a background
I have an Android application which has four tabs (I use a main TabActivity
I have four models that are related to one another, the way I have

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.