views:

57

answers:

1

I have an Android app with 3 tabs in a TabHost (text labels, no images). I set up the tabs like so:

intent = new Intent().setClass(this, AnnouncementsActivity.class);
spec = tabHost.newTabSpec("news").setIndicator("News").setContent(intent);
tabHost.addTab(spec);

I start up a background thread to fetch announcements from my server and I want to update the text label on the tab to tell the user how many new announcements there are. For example, I want to change the text on the Tab to "News (3)". How can I access and change the text label on the tab?

Any suggestions are welcome!

A: 

Look in the code demonstrated here, see at the end of the code there is hacky way to get the textView.

Ilija
Thanks for the reply. I don't have a problem getting access to the TabHost, my problem is that I can't find anything in the TabHost that allows me to change the text on the tab. How do I change the text once I have the TabHost reference?
Kenny Wyland
Ok, thanks for the link. You're right, it is really hackish and I'm not sure why there isn't an easier way, but it is working for me so it'll do for now. Thanks again!
Kenny Wyland