You must override onSaveInstanceState and save the selected position of the navigation list to combine. Remember to restore your position in onCreate .
See an example below:
public class MainActivity { private static final String CURRENT_FRAGMENT_TAG = "fragmentPosition"; @Inject @Named("navigationFragments") private Provider<? extends Fragment>[] fragmentProviders; @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(ArrayAdapter.createFromResource( this, R.array.navigation_menu, android.R.layout.simple_list_item_1), new ActionBar.OnNavigationListener() { @Override public boolean onNavigationItemSelected(int itemPosition, long itemId) { final String fragmentTag = "fragment-" + itemPosition;
Provider<? extends Fragment>[] fragmentProviders Provider<? extends Fragment>[] fragmentProviders is a list of objects of the factory method that creates a new fragment. Replace getSupportActionBar() with getActionBar() and getSupportFragmentManager() with getFragmentManager() if you are not using actionbarsherlock
acc15 source share