Last active
August 29, 2015 14:27
-
-
Save noaht11/036c6462ffad6aac005f to your computer and use it in GitHub Desktop.
How to save very simple state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String STATE_COUNTER = "counter"; | |
private int mCounter; | |
... | |
@Override | |
protected void onSaveInstanceState(Bundle outState) { | |
// Make sure to call the super method so that the states of our views are saved | |
super.onSaveInstanceState(outState); | |
// Save our own state now | |
outState.putInt(STATE_COUNTER, mCounter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment