Cercando su google ho trovato questa soluzione:
Adding tabs dynamically to a TabHost is easy. You create a TabSpec and keep adding them to the TabHost.
However, deleting the tabs is not (as easy).You might want to read this thread
and this issue
The easiest approach to deleting Tabs, that I can think of is(it comes at cost of more memory):
1. Remember all the TabSpecs that you are adding to your TabHost.
2. When the time comes to delete a Tab, remove the TabSpec first from your memory
3. Clear all the tabs from the TabHost
4. Recall all the TabSpecs in your memory and add them back.
// data structure, what I referred to as memoryFonte
ArrayList<TabHost.TabSpec> list = new ArrayList<TabHost.TabSpec>();
// when you are adding tabs to tab host
// what you add, you remember
TabHost.TabSpec spec = tabs.newTabSpec("tag1");
// when you want to remove
list.remove(list.size()-1); // remove it from memory
tabs.clearAllTabs(); // clear all tabs from the tabhost
for(TabHost.TabSpec spec : list) // add all that you remember back
Non l'ho provato