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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:34:58+00:00 2026-05-22T11:34:58+00:00

I followed the Android tutorial (as well as some other threads here at Stackoverflow..)

  • 0

I followed the Android tutorial (as well as some other threads here at Stackoverflow..)

Now I want to incorporate twitter client into one of the tabs. The tutorial is this: Twitter Client

Thus far I have the following structure:

HelloTabWidget.java

MyTwitter.java (previously artists.java – also my first tab)

AlbumsActitivity.java (2nd tab)

SongsActitivity.java (3rd tab)

For each of the tabs, I have their own drawable xml (for the icons). I also have main.xml in the layout.

So now I started with the tutorial, but how do I modify main.xml when (1) no graphical display is available, and (2) this main.xml controls only the outline.

Then I thought about creating a mytwitter.xml but how do I tell the actitivty to use mytwitter.xml to display the content (while main.xml keeps the outline of the whole app’s layout)?

In summary, how do I specify the content layout for each tab??? I see in HelloTabWidget.java we have setContent (refers to each tab’s tab xml).

Thank you very much for any input!


Update
I am posting codes.
(1) HelloTabWidget.java
(2) main.xml
(3) MyTwitter.java

In the main.xml, I defined tabview2 (linear layout) with a button. I changed the parameter of setContentView to R.id.tabview2, but I got “force to quit”

According to CAT, I have the following errors:

05-17 10:29:14.402:
ERROR/AndroidRuntime(796): FATAL
EXCEPTION: main

05-17 10:29:14.402:
ERROR/AndroidRuntime(796):
java.lang.RuntimeException: Unable to
start activity
ComponentInfo{ywong02.android.HelloTabWidget/ywong02.android.HelloTabWidget.HelloTabWidget}:
java.lang.RuntimeException: Your
content must have a TabHost whose id
attribute is ‘android.R.id.tabhost’

What should I do?
Again, I want to display, say, a button on the first tab (namely, MyTwitter)

  • 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-22T11:34:59+00:00Added an answer on May 22, 2026 at 11:34 am

    You have to use a layout, xml or not, in every activity. I mean every Activity must call setContentView to display its contents. If there’s something that you need to reuse you can use the include tag, the same way you use it in JSP.

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

Sidebar

Related Questions

I've followed this tutorial: http://anandhansubbiah.com/blog/writing-your-first-android-application/ , but no matter what I do, and what
I just downloaded the android sdk from the adnroid site and followed this tutorial
I'm new to Android, I've followed the hello world tutorial through and have a
I followed the tutorial here but when I create the project in Eclipse, i
I'm using Eclipse 3.5.2 and when I followed the steps on this tutorial( http://developer.android.com/guide/developing/tools/adt.html
I followed this tutorial to create a color state list for a particular Android
I've followed a standard tutorial for building a database with Android. I've created a
I followed example as http://www.androidpeople.com/android-custom-dynamic-listview/ However I bump into problem applying autoscroll to bottom
I am working on an alarm app. I followed the Android AlarmController tutorial word
I followed the instructions in the Android WebView tutorial (at http://developer.android.com/resources/tutorials/views/hello-webview.html ). When I

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.