How to get the bundle that is given to this method on request (Bundle outState)?
@Override
protected void onSaveInstanceState(***Bundle outState***) {
super.onSaveInstanceState(outState);
// Only if you need to restore open/close state when
// the orientation is changed
if (adapter != null) {
adapter.saveStates(outState);
}
}
It's the
Bundle
sent in theOnCreate
method in your activity.Note that you'll have to check for null, because the first time you create your activity it will be null, since there was no previous state.
see https://developer.android.com/guide/components/activities/activity-lifecycle.html#oncreate for more information