Last active
January 18, 2017 15:04
-
-
Save nontravis/a00a60ff9c0ea5d9189132a0328e49e4 to your computer and use it in GitHub Desktop.
SwitchViewGroup_savedstate
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
public class SwitchViewGroup extends BaseViewGroup{ | |
... | |
@Override | |
public Parcelable onSaveInstanceState(){ | |
Parcelable superState = super.onSaveInstanceState(); | |
// Must call | |
SavedState ss = (SavedState) onSaveInstanceChildState( new SavedState( superState ) ); | |
//save data here | |
return ss; | |
} | |
@Override | |
public void onRestoreInstanceState( Parcelable state ){ | |
if( !( state instanceof SavedState ) ){ | |
super.onRestoreInstanceState( state ); | |
return; | |
} | |
SavedState ss = (SavedState) state; | |
super.onRestoreInstanceState( ss ); | |
//restore data here | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment