Last active
July 6, 2019 11:18
-
-
Save matthew-carroll/7536e024952e5cb15b4845d47cf44816 to your computer and use it in GitHub Desktop.
Implements onSaveInstanceState in a custom View in Android.
This file contains hidden or 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
@Override | |
public Parcelable onSaveInstanceState() { | |
// Obtain any state that our super class wants to save. | |
Parcelable superState = super.onSaveInstanceState(); | |
// Wrap our super class's state with our own. | |
SavedState myState = new SavedState(superState); | |
myState.name = this.name; | |
myState.index = this.index; | |
// Return our state along with our super class's state. | |
return myState; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment