Android Forum » Android Developer Forum » Android Developer Forum » Keep the last selected tab after moving to page 2 android

Keep the last selected tab after moving to page 2 android

Keep the last selected tab after moving to page 2 android
created on Nov 22, 2012 6:21:49 AM
i have two tabs tab1 and tab2 on my homescreen by default tab1 is selected ,I select tab2 and go to other screen when i return i found tab1 is selected problem-i want the tab which was selected previously should retain selected when go to another screen
Reply with quote Reply Link ±0     (0 votes)
RE: Keep the last selected tab after moving to page 2 android
created on Dec 3, 2012 11:57:34 PM
Can you explain a bit more? Do you mean switch from one view to another then go back?
Reply with quote Reply Link ±0     (0 votes)
RE: Keep the last selected tab after moving to page 2 android
created on Feb 4, 2013 12:50:41 PM
brief your problem.
Reply with quote Reply Link ±0     (0 votes)
RE: Keep the last selected tab after moving to page 2 android
created on Mar 7, 2013 7:55:03 PM
You need to save the currently selected tab yourself:

@Override
protected void onSaveInstanceState (Bundle state) {
super.onSaveInstanceState(state);
state.putInt(POSITION, getCurrentItem());
}
Reply with quote Reply Link ±0     (0 votes)