2012-02-19 5 views
0

le titre explique tout cela je veux que si l'utilisateur choisit un autre onglet puis l'ancien robinet effacer certains textes, mais je ne sais pas comment atteindre cet événement, j'ai créé le onglets en utilisant ce codeAndroid multiples onglets voir comment savoir si on est sélectionné

th = (TabHost) findViewById(R.id.tabhost); 
     th.setup(); 
      spec=th.newTabSpec("tag1"); 
     spec.setContent(R.id.tab1); 
     spec.setIndicator("tap1"); 
     th.addTab(spec);   
     spec=th.newTabSpec("tag2"); 
     spec.setContent(R.id.tab2); 
     spec.setIndicator("tap2");     
     th.addTab(spec); 
     th.setCurrentTab(1); 

Répondre

0

Enregistrer un TabHost.OnTabChangeListener:

tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener{ 

    public void onTabChanged(String tabId){ 
     // do something here 
    } 
}) 
Questions connexes