0

My problem is that when Activity runs into savedInstanceState, it causes the below error:

Caused by java.lang.RuntimeException Parcel android.os.Parcel@2c89385: Unmarshalling unknown type code 7929970 at offset 132

In my project, there are only one class implements Parcelable to pass data between fragments. It contains a HashMap to store data.

public class SimiData implements Parcelable {

public static final Creator<SimiData> CREATOR = new Creator<SimiData>() {
    @Override
    public SimiData createFromParcel(Parcel in) {
        return new SimiData(in);
    }

    @Override
    public SimiData[] newArray(int size) {
        return new SimiData[size];
    }
};
protected HashMap<String, Object> mData;

public SimiData(HashMap<String, Object> data) {
    mData = data;
}

protected SimiData(Parcel in) {
    try {
        mData = in.readHashMap(HashMap.class.getClassLoader());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

@Override
public int describeContents() {
    return 0;
}

@Override
public void writeToParcel(Parcel dest, int flags) {
    try {

        if (null == mData) {
            return;
        }

        dest.writeValue(mData);
    } catch (Exception e) {
        Log.e("SimiData", "write exception " + e.getMessage());
    }
}

public HashMap<String, Object> getData() {
    return mData;
}

}

I guess the problem caused by read/write value to Parcel. I have tried many ways but nothing worked for me.

Can anybody give me a direction for this?

Glenn
  • 33
  • 1
  • 7

0 Answers0