TabHost remove all content activities

Posted by tiex on Stack Overflow See other posts from Stack Overflow or by tiex
Published on 2010-05-09T07:41:56Z Indexed on 2010/05/09 7:48 UTC
Read the original article Hit count: 359

Filed under:
|
|

I have a code for populating content for tabs dynamically. First time it works ok, but when I want to replace tabs (and their content) with new content - tabs are changed but tabs' contents are not, how can I clear completely whole TabHost and replace with other content?

TabHost tabHost = getTabHost();
Intent intent;
TabHost.TabSpec spec;

tabHost.setCurrentTab(0);
tabHost.clearAllTabs();

int idx = 0;
for(Group g: c.getGroups()){
            intent = new Intent().setClass(this, GroupActivity.class);

            ItemLookup.createForGroup(idx).putToIntent(intent);

            spec = tabHost
                .newTabSpec("tab"+idx)
                .setIndicator(g.getTitle())
                .setContent(intent);
            tabHost.addTab(spec);
            idx++;

} tabHost.setCurrentTab(0);

© Stack Overflow or respective owner

Related posts about android

Related posts about tabhost