TabHost remove all content activities
- by tiex
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);