Reputation: 12352
If I have a listener for changed tab like this:
mTabHost.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
if (mTabHost.getCurrentTab() == 0) {
//..
}
else if (mTabHost.getCurrentTab() == 1) {
//..
}
else if (mTabHost.getCurrentTab() == 2) {
//..
}
}
});
How can I fire the onTabChanged()
method programmatically?
Upvotes: 0
Views: 1244
Reputation: 22637
Just call,
mTabHost.setCurrentTab(id);
Or
mTabHost.setCurrentTabByTag(tag);
For reference,
http://developer.android.com/reference/android/widget/TabHost.html
Upvotes: 3