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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:13:26+00:00 2026-05-24T19:13:26+00:00

I want to make an android application which has two tap in one view

  • 0

I want to make an android application which has two tap in one view ,i.e, has upper tab and lower tab.

According to selection of lower tab, I add the new tab host(for upper tab) in the tapcontent part of lower tab. But, upper tap doesn’t go up, it stick to the lower tab.

The implementation of upper tab is,

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;



 public class uppertab extends TabActivity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
  super.onCreate(savedInstanceState);

  setContentView(R.layout.upperlayout);

  TabHost tabHost = getTabHost();
  TabHost.TabSpec spec;
  Intent intent;

  intent = new Intent().setClass(this, recommend_friend_simillar.class);  
  spec = tabHost.newTabSpec("upper1").setIndicator("Upper1").setContent(intent);
  tabHost.addTab(spec);

  intent = new Intent().setClass(this, recommend_friend_new.class);  
  spec = tabHost.newTabSpec("upper2").setIndicator("Upper2").setContent(intent);
  tabHost.addTab(spec);

  intent = new Intent().setClass(this, recommend_friend_favorite.class);  
  spec = tabHost.newTabSpec("upper3").setIndicator("Upper3").setContent(intent);
  tabHost.addTab(spec);

 }
}

xml for upper tap is,

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/uppertabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TabWidget
        android:id="@+id/uppertabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@+id/uppertabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />
</LinearLayout>

xml for lower tab is,

<?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"
  >
  <TabHost 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">

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

      <FrameLayout android:id="@android:id/tabcontent"  
         android:layout_above="@android:id/tabs"
            android:layout_width="fill_parent"  
            android:layout_height="fill_parent">  
   </FrameLayout>
  </RelativeLayout>
  </TabHost>

</LinearLayout>

The result is shown below.

□□□□□□□□□□□□□□□□□□□□□□□□□□
□                        □
□                        □
□                        □
□                        □
□                        □
□□□□□□□□□□□□□□□□□□□□□□□□□□
□       □        □       □
□upper1 □ upper2 □ upper3□
□□□□□□□□□□□□□□□□□□□□□□□□□□
□ lower1□lower2  □ lower3□
□□□□□□□□□□□□□□□□□□□□□□□□□□

Of course, upper 3 taps should be stick to ceilling, like,

□□□□□□□□□□□□□□□□□□□□□□□□□□
□       □        □       □
□upper1 □ upper2 □ upper3□
□□□□□□□□□□□□□□□□□□□□□□□□□□
□                        □
□                        □
□                        □
□                        □
□                        □
□□□□□□□□□□□□□□□□□□□□□□□□□□
□ lower1□ lower2 □ lower3□
□□□□□□□□□□□□□□□□□□□□□□□□□□

(I got an advice that using activitygroup, but it doesn’t work.)

import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class uppertab extends ActivityGroup {


 private TabHost tabHost;
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.upperlay);

 tabHost = (TabHost)findViewById(R.id.friendtabhost);

 tabHost.setup(getLocalActivityManager());



tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("tab1").setContent(new Intent(this, tab1.class)));

     tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator("tab2").setContent(new Intent(this, tab2.class)));

     tabHost.addTab(tabHost.newTabSpec("tab3").setIndicator("tab3").setContent(new Intent(this, tab3.class)));

}

}

DDMS says that

tabHost.setup(getLocalActivityManager());

has a problem.

What can I do :(?

  • 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-24T19:13:27+00:00Added an answer on May 24, 2026 at 7:13 pm

    In order to achieve this kind of requirement, where multiple touch events to be generated. You need to design your own control.

    Example :- Create and linear layout place one label, place another button on top of it. Now the other control for which you need second tap. All binded together can look like tab simulation. You can have multiple touch elements in one tab and you can get the each touch event triggered seperately.

    Best Regards
    Vinod

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

Sidebar

Related Questions

I'm learning Android programming, and I want to make an application which has to
I am currently working on one android application which has C2DM implementation and I
I want to make an android application that shows a listing of applications (downloaded
I want to make some changes to the stock Mms Android application and install
I have an Android application from which I want to upload some data to
i want to create such application in android which will be activated when i
I want to develop an Android application which can run on all ,screen type
Background: I have started Android recently. I want to make an application for Android
Here i already make one customize home screen launcher application for android. Now i
I want to make my home screen for my android application like Facebook for

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.