tags:

views:

600

answers:

1

Hello,

I use this forum a lot and find it super useful. I am having some trouble with my application. I Have a TabView setup and it works properly. I poll a server for data in a background thread. If I return any data, I want to set an indicator on the tab to let people know that there is new data in that view.

I can't access the tab itself or it's drawable. I tried what I saw suggested here and inflated the tab at setIndicator with a external layout file, which works to populate the TabView, pretty slick! I did this because I thought that then I could reference the tab's children by ID and then manipulate them (change the text or drawable or whatever I put in there.) however, I get an error but the log isn't specific on what the error is.

I create the tab in the onCreate for the TabView

 // Create intents to launch chats view activity
 intent = new Intent().setClass(this, ChatsView.class);

// Initialize a TabSpec for chats view and add to tab view spec = tabHost.newTabSpec("chats").setIndicator(getLayoutInflater().inflate(R.layout.indicator, null)) .setContent(intent); tabHost.addTab(spec);

And then in monitorChats I ask to update the TextView I inflated into the tab.

private void monitorChats(data) {

if (Integer.valueOf(data)>0){

TextView chatlabeltext = (TextView) findViewById(R.id.TextView01); chatlabeltext.setBackgroundColor(R.color.blue);

}

}

How can I go about changing the content of a tab when I want to?

A: 

check this. completely

Praveen Chandrasekaran
I think I wasn't clear, I apologize. I want to change the content of a tab it self, not the view that it's going to show. If I have a tab that says chats with an chat bubble icon, I want to have the ability to change the bubble icon in the actual tab to show a badge overlayed on the bubble with the amount of chats that are new.
chedstone