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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:07:48+00:00 2026-06-05T01:07:48+00:00

I am self learner to android. Right now i have five pages in an

  • 0

I am self learner to android.
Right now i have five pages in an android application.The first page contains two buttons(button1,button2).If i trigger the button1 it should go to the second page,which contains one button,again if i trigger this button finally it should simply display a tab host which laying on the third page.Likewise if i trigger the button2 from the page one it should go to page four and page five as like what the button1 has done.

During at run when i am clicking the button from page four,it shown error message as
Sorry! The application Tabhost_demo has stopped unexpectedly.please try again!
(Note : Other Pages activities are working well rather than four and five).

Refer java class source

public class First_index extends Activity {

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

    Button btn1 = (Button) findViewById(R.id.button_parent);
    btn1.setOnClickListener(new View.OnClickListener() {

        public void onClick(View view) {
           Intent myIntent = new Intent(view.getContext(), Index_parent.class);
           startActivityForResult(myIntent, 0);
          }
});

This is for page switching right?


AND THIS SOURCE IS FOR TABHOSTING

    public class Parent_concpt extends TabActivity {  
        /** Called when the activity is first created. */  
        @Override  
        protected void onCreate(Bundle savedInstanceState) {  
            super.onCreate(savedInstanceState);  
            setContentView(R.layout.main3);  

            TabHost tabHost = getTabHost();

            // Tab for Attendance
            TabSpec pho = tabHost.newTabSpec("Attendance");
            // setting Title and Icon for the Tab
            pho.setIndicator("Attendance",getResources().getDrawable(R.drawable.icon_att_parent));
        Intent phoIntent = new Intent(this, Att_parents.class);
        pho.setContent(phoIntent);

        // Tab for Marks
        TabSpec mrk = tabHost.newTabSpec("Achievement");
        mrk.setIndicator("Achievement",     getResources().getDrawable(R.drawable.icon_achieve_parents));
        Intent mrkIntent = new Intent(this, Achieve_parents.class);
        mrk.setContent(mrkIntent);

        // Tab for Fee
        TabSpec fees = tabHost.newTabSpec("Fee details");
            fees.setIndicator("Fee details",getResources().getDrawable(R.drawable.icon_fee_details));
        Intent feesIntent = new Intent(this, Feedet_parents.class);
        fees.setContent(feesIntent);

        // Adding all TabSpec to TabHost
        tabHost.addTab(pho);
        tabHost.addTab(mrk);
        tabHost.addTab(fees);}}

My ambigution is,i guess only the problem is on Manifest.xml file.IS THERE ANY PERMISSIONS AVAILABLE TO MENTION FOR EVERY ACTIVITY?


Refer Manifest.xml source

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.demo.student"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >

        <activity android:name=".First_index"
                  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=".Index_parent"></activity>


        <activity android:name=".Index_parent"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN1" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".Parent_concpt"></activity>

        <activity android:name=".Parent_concept"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN3" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

         <!--  Att_parents -->
         <activity android:name=".Att_parents" />

         <!--  Achieve_parents -->
         <activity android:name=".Achieve_parents" />

         <!--  Feedet_parents -->
         <activity android:name=".Feedet_parents" />


        <activity android:name=".Index_principal"
                  android:label="@string/app_name">
             <intent-filter>
                <action android:name="android.intent.action.MAIN2" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
         </activity><activity android:name=".Princy_concept"></activity>

          <activity android:name=".Princy_concept"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN7" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
         </activity>

         <!--  Att_principal Activity -->
         <activity android:name=".Att_principal" />

         <!--  Perform_principal Activity -->
         <activity android:name=".Perform_principal" />

         <!--  Coll_principal Activity -->
         <activity android:name=".Coll_principal" />

         <!--  Xpense_principal Activity -->
         <activity android:name=".Xpense_principal" />

         </application>
    </manifest>

NOTE : I have perfectly mentioned each and every class and layout’s file name perfectly.

Please refer my logcat here
LOGCAT

05-21 12:13:16.013: W/KeyCharacterMap(274): No keyboard for id 0
05-21 12:13:16.013: W/KeyCharacterMap(274): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
05-21 12:13:19.843: D/AndroidRuntime(274): Shutting down VM
05-21 12:13:19.843: W/dalvikvm(274): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-21 12:13:19.853: E/AndroidRuntime(274): FATAL EXCEPTION: main
05-21 12:13:19.853: E/AndroidRuntime(274): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.demo.student/com.android.demo.student.Princy_concept}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.os.Looper.loop(Looper.java:123)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.ActivityThread.main(ActivityThread.java:4627)
05-21 12:13:19.853: E/AndroidRuntime(274):  at java.lang.reflect.Method.invokeNative(Native Method)
05-21 12:13:19.853: E/AndroidRuntime(274):  at java.lang.reflect.Method.invoke(Method.java:521)
05-21 12:13:19.853: E/AndroidRuntime(274):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-21 12:13:19.853: E/AndroidRuntime(274):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-21 12:13:19.853: E/AndroidRuntime(274):  at dalvik.system.NativeStart.main(Native Method)
05-21 12:13:19.853: E/AndroidRuntime(274): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.TabActivity.onContentChanged(TabActivity.java:105)
05-21 12:13:19.853: E/AndroidRuntime(274):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.Activity.setContentView(Activity.java:1647)
05-21 12:13:19.853: E/AndroidRuntime(274):  at com.android.demo.student.Princy_concept.onCreate(Princy_concept.java:16)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-21 12:13:19.853: E/AndroidRuntime(274):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-21 12:13:19.853: E/AndroidRuntime(274):  ... 11 more

Thanks for your help!

  • 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-05T01:07:50+00:00Added an answer on June 5, 2026 at 1:07 am

    It is telling you that in your layout main3, you must have a TabHost named android.R.id.tabhost

    In onCreate() you are inflating main3:

    setContentView(R.layout.main3);
    

    Open up main3.xml and make sure your layout looks 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:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:padding="5dp" >
    
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />
    
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:padding="5dp" />
        </LinearLayout>
    
    </TabHost>
    

    Note the TabHost‘s name and the name of the TabWidget.

    See here for a full example.

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

Sidebar

Related Questions

i am self-leaner to android.Right now i am consuming web service in android eclipse
I'm building an application that needs to open self-signed HTTPS SSL URLs in java.
I have an application, which displays me some data. I need to attach to
I have an application, which displays me some data. I need to attach to
I have a three tab application that shares a plist for connection information (Client
I'm in a data structures course right now and we learned about 2-3-4 trees
I feel like this is something that I should have learned by now, and
Is there anything I can use to have PHP execute in a self contained
I am self-leaner to android and java.Is there any session variables available in android
[[self enclosingScrollView] setHorizontalLineScroll:0]; the above api doesnt works. Help Appreciated...

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.