我的应用的某些实例收到此错误:
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = for.super)
at android.os.Parcel.writeSerializable(Parcel.java:1181)
at android.os.Parcel.writeValue(Parcel.java:1135)
at android.os.Parcel.writeMapInternal(Parcel.java:493)
at android.os.Bundle.writeToParcel(Bundle.java:1612)
at android.os.Parcel.writeBundle(Parcel.java:507)
at android.support.v4.app.FragmentState.writeToParcel(SourceFile:132)
at android.os.Parcel.writeTypedArray(Parcel.java:1004)
at android.support.v4.app.FragmentManagerState.writeToParcel(SourceFile:368)
at android.os.Parcel.writeParcelable(Parcel.java:1156)
at android.os.Parcel.writeValue(Parcel.java:1075)
at android.os.Parcel.writeMapInternal(Parcel.java:493)
at android.os.Bundle.writeToParcel(Bundle.java:1612)
at android.os.Parcel.writeBundle(Parcel.java:507)
at android.support.v4.app.FragmentState.writeToParcel(SourceFile:133)
at android.os.Parcel.writeTypedArray(Parcel.java:1004)
at android.support.v4.app.FragmentManagerState.writeToParcel(SourceFile:368)
at android.os.Parcel.writeParcelable(Parcel.java:1156)
at android.os.Parcel.writeValue(Parcel.java:1075)
at android.os.Parcel.writeMapInternal(Parcel.java:493)
at android.os.Bundle.writeToParcel(Bundle.java:1612)
at android.os.Parcel.writeBundle(Parcel.java:507)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:1931)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2866)
at android.app.ActivityThread.access$900(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1164)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.NotSerializableException: android.support.v4.app.FragmentManagerImpl
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
at android.os.Parcel.writeSerializable(Parcel.java:1176)
... 32 more
我不知道如何复制这个,但是当应用程序停止时,看看堆栈跟踪似乎正在发生。
我真的不明白为什么android会尝试序列化/包裹我的片段,我没有在任何地方实现onSaveInstanceState / onRestoreInstanceState。
有人能帮帮我吗?
由于 卢卡
编辑: 感谢您的回答。 不,我没有任何自定义的任何视图,
可能是一种解决此错误的方法,在不调用suoer.onSaveInstanceState的情况下重写onSaveInstanceState?
答案 0 :(得分:0)
默认实现通过在具有id的层次结构中的每个视图上调用onSaveInstanceState()并保存当前焦点视图的id(所有这些都是由onRestoreInstanceState(Bundle)的默认实现恢复。
您是否拥有自定义View实现或使用新字段扩展基本视图并在片段中使用它?