I\'m trying to fix the issue with restarting activity on orientation changes.
I have an ActionBar with drop-down list navigation and after every rotatio
As of support library v7, you just need to save / restore the state of the ActionBar:
private static final String STATE_SELECTED_NAVIGATION_ITEM = "selectedNavItem";
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
// Restore the previously serialized current dropdown position.
if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) {
getSupportActionBar().setSelectedNavigationItem(
savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM));
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
// Serialize the current dropdown position.
outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, getSupportActionBar()
.getSelectedNavigationIndex());
}