TabHost remove all content actions
I have some code for dynamically filling content for tabs. The first time it works fine, but when I want to replace the tabs (and their contents) with new content - the tabs change, but the contents of the tabs are not, how can I completely clear the 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);
+2
a source to share
2 answers