Answer the question
In order to leave comments, you need to log in
I add a new code, I break the old one, what is it?
I am writing code to save variables when changing screen orientation.
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
Log.i(TAG, "onSaveInstanceState");
savedInstanceState.putInt(KEY_INDEX, mCurrentIndex);
savedInstanceState.putBooleanArray(KEY_INDEX, array);
}
if (savedInstanceState != null) {
mCurrentIndex = savedInstanceState.getInt(KEY_INDEX, 0);
array = savedInstanceState.getBooleanArray(KEY_INDEX);
}
Answer the question
In order to leave comments, you need to log in
Keys must be different for different variables.
And you have one key - KEY_INDEX.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question