https://kotlinlang.org logo
#android
Title
# android
g

Gabriel Feo

07/20/2020, 5:09 PM
Is there any
@Parcelize
equivalent for saving custom view state?
c

Casey Brooks

07/20/2020, 5:57 PM
@Parcelize
is placed on
Parcelable
classes, which can directly be returned from
onSaveInstanceState()
, or placed in a Bundle. Normally this is done in an Activity, though I think it can be done with Views as well (though it looks like there’s a bit of additional boilerplate to make it work https://developer.android.com/reference/android/view/View.BaseSavedState)
g

Gabriel Feo

07/20/2020, 6:12 PM
Thanks, I meant to ask if there’s something like Parcelize to reduce the boilerplate of subclassing BaseSavedState/AbsSavedState
Just realized I can simply use @Parcelize and not extend AbsSavedState at all though, as long as I save the super’s state myself