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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:32:58+00:00 2026-06-02T13:32:58+00:00

I am trying to make tabs layout. I am using tutorial code (below) but

  • 0

I am trying to make tabs layout. I am using tutorial code (below) but it doesn’t work. LogCat gives this error:

04-19 19:02:16.297: ERROR/AndroidRuntime(455): java.lang.RuntimeException: Unable to start activity ComponentInfo{jusbrz.bakalauras/jusbrz.bakalauras.FilesTabsActivity}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is ‘android.R.id.tabhost’

I added new activitys to manifest.

XML:

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

Using this code in main activity:

package jusbrz.bakalauras;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
public class FilesTabsActivity extends TabActivity{
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.files_tabs_layout);

    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, AllFilesTabActivity.class);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost.newTabSpec("Visi").setIndicator("Visi").setContent(intent);
    tabHost.addTab(spec);
}
}

So where might be the problem?

EDITED

import android.app.TabActivity;
import android.os.Bundle;

public class AllFilesTabActivity extends TabActivity{
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.all_files_tab_layout);

        }

}
  • 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-02T13:33:00+00:00Added an answer on June 2, 2026 at 1:33 pm

    you are missing tabhost id in layout.update your layout as:

    <TabHost
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@android:id/tabhost">
    

    Update your class FilesTabsActivity :

    TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
    TabSpec firstTabSpec = tabHost.newTabSpec("Visi");
    firstTabSpec.setIndicator("Visi").setContent(new Intent(this,AllFilesTabActivity.class));
    /** Add tabSpec to the TabHost to display. */
    tabHost.addTab(firstTabSpec);
    

    AND IF YOU ARE IF YOU ARE ADDING TAB DYNAMICALLY:

    setContentView(R.layout.files_tabs_layout);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make tabs and am using easytabs. By the below code, the
So, I am trying to make a tabs menu, like this: http://flowplayer.org/tools/tabs/index.html (but i
So i'm trying to make tabs with the JQuery UI framework, but I can't
I'm trying to make an app that has three tabs, each with different but
I am trying to make use of jQueryUI AJAX tabs in my ASP.Net Webforms
Short question: I'm trying to make that in a given page (uses tabs) back
Trying to make a simple program to catalogue books. Something like this, for example:
I am trying to make a jquery similar tabs. since its for single use
As seen in the picture shown below I'm trying to make a view like
So I am trying to have a dynamic tabs kind of thing using both

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.