Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
125 views
in Technique[技术] by (71.8m points)

How to use TabHost.OnTabChangeListener in android?

How to use TabHost.OnTabChangeListener in android?

give me some example code... :(

thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

why it would be my pleasure to help you good sir:

myTabHost.setOnTabChangedListener(new OnTabChangeListener(){
@Override
public void onTabChanged(String tabId) {
    if(TAB_1_TAG.equals(tabId)) {
        //destroy earth
    }
    if(TAB_2_TAG.equals(tabId)) {
        //destroy mars
    }
}});

Where TAB_1_TAG is the tag provided to the newTabSpec method when creating the tab.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...