@Override public boolean onNavigationItemSelected(int itemPosition, long itemId) { if (lastPosition > -1) { models[lastPosition] = frag.getText(); } lastPosition = itemPosition; frag.setText(models[itemPosition]); frag.setHint(labels[itemPosition]); return true; }
@Override protected void onSaveInstanceState(Bundle outState) { if (lastPosition > -1) { models[lastPosition] = frag.getText(); } outState.putCharSequenceArray(KEY_MODELS, models); outState.putInt(KEY_POSITION, getActionBar().getSelectedNavigationIndex()); }