Skip to content

Instantly share code, notes, and snippets.

@akexorcist
Last active May 10, 2020 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akexorcist/27ec5c1ecd90826a79f05132a164e3c8 to your computer and use it in GitHub Desktop.
Save akexorcist/27ec5c1ecd90826a79f05132a164e3c8 to your computer and use it in GitHub Desktop.
SavedState and Creator of derived class in inherited custom view
class RegularPostView : BasePostView {
...
internal class SavedState : BaseSavedState {
...
constructor(source: Parcel) : super(source) {
dividerColorResId = source.readInt()
}
...
companion object {
@JvmField
val CREATOR: Parcelable.Creator<SavedState> = object : Parcelable.Creator<SavedState> {
override fun createFromParcel(source: Parcel): SavedState {
return SavedState(source)
}
...
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment