How to close TabWidget when a tab is selected in Android
In Android, how do I close TabWidget
when a tab is selected?
I want close the TabWid开发者_运维百科get
where some tab is selected.
//I use the OnTabChangeListener solve the question.
mTabHost.setOnTabChangedListener(new OnTabChangeListener(){
@Override
public void onTabChanged(String tabId) {
if (DEBUG) Log.d(TAG, "onTabChanged()");
if("testTabId".equals(tabId)) {
//destroy earth
Intent intentTabMe = new Intent(MainActivity.this, UserDetailsActivity.class);
intentTabMe.setAction(Intent.ACTION_VIEW);
startActivity(intentTabMe);
}
}
});
精彩评论