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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:18:27+00:00 2026-05-22T20:18:27+00:00

I just started with Android and I’m doing a simple app that I want

  • 0

I just started with Android and I’m doing a simple app that I want to look like this:

-------------------------------------------
|             |             |             |   
|   T  A  B   |   T  A  B   |   T  A  B   |
|  SELECTED   |             |             |   
|-----------------------------------------|
|                                         |
| VIEW FLIP CONTENT                       |
|                                         |
|                                         |
|                                         |
|                                         |
|                                         |
|                                         |
|                                         |
|                                         |
-------------------------------------------

That is, I have some tabs and each one has a view flip component. Which enables them to have internal “tabs”. The problem is that with this configuration I have to run everything on a single Activity! Also, my layout is getting huge (see image attached). How can I solve this mess? Run each tab as a single activity?

layout getting huge

  • 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-22T20:18:28+00:00Added an answer on May 22, 2026 at 8:18 pm

    It is possible to put all your tabs in different Activities. Create simple layout for your parent Activity, something like this:

    <?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">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp">
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1" />
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />    
        </LinearLayout>
    </TabHost>
    

    Now you have created the tab layout you want, now its time to fill your tabs with the Activities you want. This is done in the onCreate method of you TabActivity.

    public class MyTabActivity extends TabActivity {
        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
    
            // Create an Intent to launch an Activity for the tab (to be reused)
            intent = new Intent().setClass(this, YourFirstActivity.class);
    
    
            // Initialize a TabSpec for each tab and add it to the TabHost
            spec = tabHost.newTabSpec("NameOfSpec").setIndicator("TabText1"),null).setContent(intent);
            tabHost.addTab(spec);
    
            intent = new Intent().setClass(this, YourSecondActivity.class);
    
            spec = tabHost.newTabSpec("NameOfSpec2").setIndicator("TabText2",null).setContent(intent);
            tabHost.addTab(spec);
    
            tabHost.setCurrentTab(0);
        }
    }
    

    This is it, now you have a tabhost with 2 tabs in it, to add more just keep adding more tabhosts. And ofcourse you need to change the text for each tab, and fill in your own activities instead of “YourFirstActivity” and “YourSecondActivity”.

    For a tutorial, take a look here: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

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

Sidebar

Related Questions

I have just started android. I just want to know that how can i
I just started doing some Android app development, and I decided I'm going to
I've just started out with android and write a simple dialog app with some
Just started getting a bunch of errors on our C# .Net app that seemed
I have just started with android in Eclipse and now i want to do
I'm just getting started with android programming, and want to see if there is
I'm just getting started with Android app development on a Mac, and I keep
I started building an Android app that uses a flat file for storage. The
I just started using the WPF WebBrowser that is included in Net 3.5 SP1.
I just started using SVN, and I have a cache directory that I don't

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.