Both tab views of tabhost showing at once
<p>I have a tabhost with 2 tabs, each a separate view which contains a listview.  When you click on an item in the first tab, it is copied to the second tab.  The problem is, when I do this I can see the items showing up on the 2nd tab's view, i.e both tabs are showing at the same time.  If i jump to the other tab and back, the problem goes away, or what I have done in code is to use setCurrentTab() on the 2nd tab and then back to the first tab, and this removes the problem.  But why are they both showing in the first place?  </p>

<p>The code is:</p>

<pre><code>public class TabWithListViewsActivity extends TabActivity implements OnTabChangeListener {

private static final String LIST1_TAB_TAG = "List1";
private static final String LIST2_TAB_TAG = "List2";

private static final ArrayList&lt;HashMap&lt;String,String&gt;&gt; list = 
        new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); 

// The two views in our tabbed example
private ListView listView1;
private ListView listView2;

private TabHost tabHost;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    tabHost = getTabHost();
    tabHost.setOnTabChangedListener(this);

    // setup list view 1
    listView1 = (ListView) findViewById(R.id.list1);
    SimpleAdapter adapter = new SimpleAdapter(
            this,
            list,
            R.layout.list_item_custom_font,
            new String[] {"name","address"},
            new int[] {R.id.text1,R.id.text2}
            );
    listView1.setAdapter(adapter);
    populateList(); //puts the name/address pairs into the list

    // setup list view 2
    listView2 = (ListView) findViewById(R.id.list2);
    List&lt;String&gt; list2Strings = new ArrayList&lt;String&gt;(); //empty to begin with
    listView2.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, list2Strings));

    // add an onclicklistener to add an item from the first list to the second list
    listView1.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View view, int position, long id) {
            HashMap item =  (HashMap) listView1.getAdapter().getItem(position);
            if(item != null) {
                ((ArrayAdapter) listView2.getAdapter()).add(item.get("name"));
                Toast.makeText(TabWithListViewsActivity.this, item.get("name") + " added to list 2", Toast.LENGTH_LONG).show();
            }
        }
    });

    // add views to tab host
    tabHost.addTab(tabHost.newTabSpec(LIST1_TAB_TAG).setIndicator(LIST1_TAB_TAG).setContent(new TabContentFactory() {
        public View createTabContent(String arg0) {
            return listView1;
        }
    }));
    tabHost.addTab(tabHost.newTabSpec(LIST2_TAB_TAG).setIndicator(LIST2_TAB_TAG).setContent(new TabContentFactory() {
        public View createTabContent(String arg0) {
            return listView2;
        }
    }));
    tabHost.setCurrentTabByTag(LIST2_TAB_TAG);
    tabHost.setCurrentTabByTag(LIST1_TAB_TAG);
}
</code></pre>
