-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
When I need to save a list of parcelable objects whose type has been subclassed, it doesn't save the members of the subclass.
class A {
ArrayList<B> list;
...
}
class B {
...
}
class C extends B {
// members in addition to members of class B that should be saved when saving list
}
This causes a difficult to trace RunTimeException when unparcelling the list. The RTE is something like
java.lang.RuntimeException: Parcel android.os.Parcel@XXX: Unmarshalling unknown type code YYY at offset ZZZ}
This happens because of the writeTypedArrayList method. I fixed the error by replacing this method with writeList and the readTypedArrayList method with readList as well.
Here is a larger writeup done by someone who experienced this same scenario without the plugin
https://medium.com/@kcoppock/writing-parcelable-lists-with-inheritance-a739c42c055c
Metadata
Metadata
Assignees
Labels
No labels