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

The Archive Base Latest Questions

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

I made a tabHost in an Activty and everytime it reaches the .addTab(Spec) it

  • 0

I made a tabHost in an Activty and everytime it reaches the .addTab(Spec) it crashes.
I created the tab host in the Activity like so:

peopleTabHost = new TabHost(this);

and then I use a method to add the tab (I can do that because I defined the peopleTabHost as final outside of the onCreat)

    private void CreateNewTab(String tagName, String displayedName, Class<?> intentClass)
    {
          Intent intent = new Intent().setClass(this,  intentClass);
          TabHost.TabSpec spec = peopleTabHost.newTabSpec(tagName).setIndicator(displayedName);
          spec.setContent(intent);
          peopleTabHost.addTab(spec);       
    }

Thanks

  • 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-27T21:51:19+00:00Added an answer on May 27, 2026 at 9:51 pm

    I second sianis’ answer, but I’m also adding that it might be crashing because you are not initializing (or at least not showing) the tabhost.

    Try to run peopleTabHost.setup(); right after calling the constructor.

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

Sidebar

Related Questions

Made a new window application. Right-clicked Frameworks > Add Existing Frameworks. Selected Frameworks folder,
I'm new to developing for Android and got really excited when I made my
I made a class for DB connection like this: public class DbHelper : IDisposable
I have made an application which has tabs like in HelloTabActivity, there is also
I have to tabs, new and REPORTS. In the REPORTS tab, I'm creating a
Made an application which targets .net 4 client. Created an installer using Inno Setup
(made a new question, as instead of having 2 questions in my other question)
Made this nice little loop for hiding and showing div's, works as a charm
Made a custom obj called Item with some string fields and one float. .h
I made a function which displays date on the webpage,, and i uploaded the

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.