Skip to content

Instantly share code, notes, and snippets.

@akexorcist
Last active May 10, 2020 10:48
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/e8dc10c0e51ed86bb84a26a19ef7eaf0 to your computer and use it in GitHub Desktop.
Save akexorcist/e8dc10c0e51ed86bb84a26a19ef7eaf0 to your computer and use it in GitHub Desktop.
Using AbsSavedState instead of BaseSavedState in base class to support inherited custom view
abstract class BasePostView : FrameLayout {
...
internal class SavedState : AbsSavedState {
var title: String? = null
var description: String? = null
constructor(superState: Parcelable) : super(superState)
constructor(source: Parcel, loader: ClassLoader?) : super(source, loader) {
title = source.readString()
description = source.readString()
}
override fun writeToParcel(out: Parcel, flags: Int) {
super.writeToParcel(out, flags)
out.writeString(title)
out.writeString(description)
}
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment