Last active
September 20, 2016 11:38
-
-
Save defHLT/18f7f13c5197f807dceb482f7e121153 to your computer and use it in GitHub Desktop.
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
var state: MutableMap<String, Any?> = HashMap() | |
private var foo: Int by state | |
private var bar: String by state | |
override fun onSaveInstanceState(): Parcelable { | |
// ... | |
putSerializable("state", state as Serializable) | |
// ... | |
} | |
override fun onRestoreInstanceState(state: Parcelable?) { | |
// ... | |
with(this.state) { | |
clear() | |
putAll(state.getSerializable("state") as MutableMap<String, Any?>) | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment