How to fix Unmarshalling unknown type code XXX at offset YYY in Android?

前端 未结 10 1897
小鲜肉
小鲜肉 2020-12-05 07:04

I\'m having app crash on resume because of Unmarshalling exception. I\'ve checked all the Serializables have constructor with no parameters and even checked all the serializ

10条回答
  •  一整个雨季
    2020-12-05 07:15

    If a type of List is added, it should be:

    @Override
        public void writeToParcel(Parcel dest, int flags) {
            super.writeToParcel(dest, flags);
            dest.writeList(this.mList);
    

    and unparcel it using the class type like this:

    protected MyClass(Parcel in) {
            super(in);
            this.mList = new ArrayList<>();
            in.readList(this.mList, MyRequiredClass.class.getClassLoader());
    

提交回复
热议问题