I have a TabActivity with 5 tabs in it and each tab has an activity defined. Irrespective of which ever t开发者_C百科ab i click, when the tabactivity screen is loaded, it always displays the first tab. Is there a way to get the last tab visited? thanks..
Store the tab in a sharedpreference, and then when the activity hosting the tab is shown, set the tab.
@Override
public void onTabChanged(String tabId) {
}
or this
tabHost.getCurrentTab()
store the tab ID or index and then set it using,
tabHost.setCurrentTab(index);
精彩评论