此哈希表的编写进展顺利,但是当我尝试读取它时,它将引发异常。
数据对象是可序列化的,正如我所说,编写它没有问题,只需要读入.readSerializable();
我还检查了数据和子字段中的所有字段,它们都是可序列化的
12-12 14:21:11.070 10173-10173/E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{activities.CustomObjectsActivity}: java.lang.RuntimeException: Parcelable encountered IOException reading a Serializable object (name = ۳)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2430)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5437)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.RuntimeException: Parcelable encountered IOException reading a Serializable object (name = ۳)
at android.os.Parcel.readSerializable(Parcel.java:2508)
at android.os.Parcel.readSerializable(Parcel.java:2477)
at models.custom_fields.CustomObject.<init>(CustomObject.java:136)
at models.custom_fields.CustomObject$1.createFromParcel(CustomObject.java:145)
at models.custom_fields.CustomObject$1.createFromParcel(CustomObject.java:142)
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeSerializable(this.custom_fields);
}
protected CustomObject(Parcel in) {
super(in);
this.customFields = (HashMap<String, Data>)
in.readSerializable();
}