Android Parcelable in Kotlin
I suspect you're using an outdated version of Kotlin compiler (since you use !
). Here's a version compiling properly with latest version:
companion object {
@JvmField
val CREATOR = object : Parcelable.Creator<KwerendaGraficzna> {
override fun createFromParcel(`in`: Parcel): KwerendaGraficzna {
return KwerendaGraficzna(`in`)
}
override fun newArray(size: Int): Array<KwerendaGraficzna?> {
return arrayOfNulls(size)
}
}
}
Since the Parcelable.Creator
requires a public static field we need to mark the CREATOR
property with @JvmField
and JvmStatic
.