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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:32:33+00:00 2026-06-16T19:32:33+00:00

i have develop one android application. Here i have to set the tabbar bottom

  • 0

i have develop one android application.

Here i have to set the tabbar bottom on all android activities.how can i do.please give me solution for these.

i have totally 10 activities means the tabbar is show on botton on all 10 activities.how can i do in android.please help me.

These is my 1st activity:

   setContentView(R.layout.tabbar);
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    TabSpec dbspec = tabHost.newTabSpec("Home");

    dbspec.setIndicator("Home", getResources().getDrawable(R.drawable.home));
    Intent dbIntent = new Intent(this, MainActivity.class);
    dbspec.setContent(dbIntent);
    tabHost.addTab(dbspec);

    TabSpec orderspec = tabHost.newTabSpec("Cart");
    orderspec.setIndicator("Cart", getResources().getDrawable(R.drawable.cart));
    Intent orderIntent = new Intent(this, ViewCartActivity.class);
    orderspec.setContent(orderIntent);
    tabHost.addTab(orderspec);
    TabSpec settingspec = tabHost.newTabSpec("My Account");
    settingspec.setIndicator("My Account", getResources().getDrawable(R.drawable.myaccount));
    Intent settingIntent = new Intent(this, CustomerLogin.class);
    settingspec.setContent(settingIntent);
    tabHost.addTab(settingspec);

tabbar.xml:

<?xml version="1.0" encoding="utf-8"?>
 <TabHost
   android:id="@android:id/tabhost"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">

       <RelativeLayout
    android:layout_width="match_parent"
    android:id="@+id/linearLayout1"
    android:layout_height="match_parent">

           <TabWidget
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@android:id/tabs"
        android:layout_alignParentBottom="true">
          </TabWidget>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@android:id/tabcontent">
    </FrameLayout>
    </RelativeLayout>
     </TabHost>

In first tab have to perform MainActivity(GridView) activity.it is woked well.in Main activity i have to clik any item means it is go to SubCate(listview) activity.Here also i have to display tabbar on bottom.how can i set.

In subcate.xml file have included below code:

<include        
 android:id="@+id/footer"

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    layout="@layout/tabbar" />

but the tabbar is not display.whats wrong here.please help me.

  • 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-16T19:32:34+00:00Added an answer on June 16, 2026 at 7:32 pm

    Please write below code instead of your code for add multiple activities in one TabActivity, it will solve your problem.

    ActivityStack.java

    public class ActivityStack extends ActivityGroup {
    
    
    private Stack<String> stack;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (stack == null)
            stack = new Stack<String>();
        // start default activity
        push("FirstStackActivity", new Intent(this, Tab_SampleActivity.class));
    }
    
    @Override
    public void finishFromChild(Activity child) {
        pop();
    }
    
    @Override
    public void onBackPressed() {
        pop();
    }
    
    public void push(String id, Intent intent) {
        Window window = getLocalActivityManager().startActivity(id, intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
        if (window != null) {
            stack.push(id);
            setContentView(window.getDecorView());
        }
    }
    
    public void pop() {
        if (stack.size() == 1)
            finish();
        LocalActivityManager manager = getLocalActivityManager();
        manager.destroyActivity(stack.pop(), true);
        if (stack.size() > 0) {
            Intent lastIntent = manager.getActivity(stack.peek()).getIntent();
            Window newWindow = manager.startActivity(stack.peek(), lastIntent);
            setContentView(newWindow.getDecorView());
        }
    }
    }
    

    TabActivity.java

    public class TabActivity extends TabActivity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.tab_screen);
            TabHost tabHost = getTabHost();
            Intent intent = new Intent().setClass(this, ActivityStack.class);
            TabHost.TabSpec spec = tabHost.newTabSpec("tabId").setIndicator("Temp", getResources().getDrawable(R.drawable.home));
            spec.setContent(intent);
    
            tabHost.addTab(spec);
    
            Intent intent1 = new Intent().setClass(this, ActivityStack.class);
            TabHost.TabSpec spec1 = tabHost.newTabSpec("tabId").setIndicator("Temp", getResources().getDrawable(R.drawable.invoice));
            spec1.setContent(intent1);
            tabHost.addTab(spec1);
    
            tabHost.setCurrentTab(0);
        }
    }
    

    FirstActivity.java

    public class FirstActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            TextView textView = new TextView(this);
            textView.setText("Tab Sample Activity ");
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.setClass(getParent(), SecondActivity.class);
                    ActivityStack activityStack = (ActivityStack) getParent();
                    activityStack.push("SecondActivity", intent);
                }
            });
            setContentView(textView);
        }
    }
    

    SecondActivity.java

    public class SecondActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            TextView textView = new TextView(this);
            textView.setText("First Stack Activity ");
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.setClass(getParent(), ThirdActivity.class);
                    ActivityStack activityStack = (ActivityStack) getParent();
                    activityStack.push("ThirdActivity", intent);
                }
            });
            setContentView(textView);
        }
    }
    

    ThirdActivity.java

    public class ThirdActivity extends Activity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        }
    }
    

    Add Below XML files into your res/layout folder.

    1) tab_screen.xml

    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:padding="3dp" >
    
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_above="@android:id/tabs"
                android:layout_weight="1" />
    
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true" />
        </RelativeLayout>
    
    </TabHost>
    

    2) main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
    
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/hello" />
    
    </LinearLayout>
    

    AndroidManifest.xml:-

    <?xml version="1.0" encoding="utf-8"?>
    
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.tabsample"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk android:minSdkVersion="8" />
    
        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name" >
            <activity
                android:name=".FirstActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
            <activity
                android:name=".TabActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity
                android:name=".ActivityStack"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
            <activity
                android:name=".SecondActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
            <activity
                android:name=".ThirdActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
    

    And see below link for more information on add multiple activities under one TabActivity with complete example.

    Android – Multiple Android Activities under one TabActivity

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

Sidebar

Related Questions

I have develop one android application. Here i have to pass the value from
I have to develop one android application. Here i have to develop grid view
Here i develop one android application and i have one image with size 197*253,
Hi i have to develop one spinner example in android.here i have to used
Hi i have to develop one spinner app. here how can i remove the
I have to develop one android application.The app is performs retrieve data from mysql
I have to develop one android send mail use javamailapi application. message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(mercy.krishnaveni@gmail.com,demo@mercuryminds.com)); Using
Hi i have develop an android application in which i want to prevent user
I occur a problem when develop a application on android. There have two image
how is support all platform version on my single android app.i have created one

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.