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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:06:50+00:00 2026-05-23T21:06:50+00:00

Firstly, Im new to android but have years of various other programming experience on

  • 0

Firstly, Im new to android but have years of various other programming experience on unix, windows,but not with Java or android.
Im wanting to display a tab with 3 tabs, each having a different layout file (which works).
Im working on displaying a “blank” template and then the data is retrieved from an XML file once the user points a setting to one (i.e. via shared preferences).

My problem is that the function populateXMLCharacter is never called (using breakpoints). The tab activity always displays “”, which is a strig the string.xml.
Actually putting a breakpoint in the oncreate function never gets called either. Ive tried using a call to populateXMLCharacter in onResume, but it too never gets called.

Im thinking its because of the call to the tab:

    Resources res = getResources(); // Resource object to get Drawables
    TabHost tabHost = getTabHost();  // The activity TabHost
    TabHost.TabSpec spec;  // Resusable TabSpec for each tab

    // Do this and the same for all tabs
    spec = tabHost.newTabSpec("Description").setIndicator("Description",
     res.getDrawable(R.drawable.android)).setContent(R.layout.tab_harp_description);
    tabHost.addTab(spec);

Should I be using an intent? I thought the layout was created in a seperate function (in this case harpCSDescription.java and then this allows that activity to be inserted into the tabhost?

other functions:
public class harpcsDescription extends Activity {

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView (R.layout.tab_harp_description);
 }
//@Override
protected void onResume() 
{
    // NOW WE ADD DATA TO THE TEMPLATE
    populateXMLCharacter();
}

public void populateXMLCharacter()
{

Ive tried using intents in the following manner but it simply crashes before any breakpoints are reached.

http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

Can some one please guide me to what I should be doing to create an activity with data that is retrieved AFTER the tab is created?

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

    I think you need an intent. To attach an activity to a tab, write the following in the tab host:

    Intent intent = new Intent(this, MyActivity.class);

    and then in the tab spec write:

    tabSpec = tabHost.newTabSpec("name").setIndicator(this.getString(R.string.name)).setContent(intent)

    Then in the MyActivity class, you can specify the layout and load the XML data to populate the tab in the onCreate() method. You can use a different activity for each tab.

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

Sidebar

Related Questions

Firstly, I am new to both android and Java. I have two classes, my
Firstly I am new to android and Java so this is a beginners question.
Firstly, I'm new to Android (so I apologize if this question is ignorant) but
Firstly I am very new to JAVA, so I apoligise if I am not
see fiddle Firstly i am new to jquery. i have to make one cell
Firstly this is not a homework question. I am practicing my knowledge on java.
Firstly, I am new to programming. I am currently having a website with 2
Firstly, I'm relatively new to network programming. I want to intercept and delay HTTP
Firstly, this is a homework assignment, and I am very new to programming in
I am pretty new to the world of Android and Java and I am

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.