java.lang.RuntimeException: Parcel android.os.Parcel: Unmarshalling unknown type code

旧时模样 提交于 2019-12-01 02:48:08
David Wasser

Your problem is in LanguagesFlashCard. Here are your parcel/unparcel methods:

protected LanguagesFlashCard(Parcel in) {
    mId = in.readInt();
    mEnglish = in.readString();
    mAnswerPrefix = in.readString();
    mAnswer = in.readString();
    mTier = in.readInt();
    mTopic = in.readParcelable(Topic.class.getClassLoader());
}

As you can see, they don't match. The second item you write to the Parcel is an int, the second item you read from the Parcel is a String.

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(mId);
    dest.writeInt(mTier);
    dest.writeString(mEnglish);
    dest.writeString(mAnswerPrefix);
    dest.writeString(mAnswer);
    dest.writeParcelable(mTopic, flags);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!