04-23 17:04:18.867: W/dalvikvm(18872): threadid=1: thread exiting with uncaught exception (group=0x40a3a1f8)
04-23 17:04:18.890: E/AndroidRuntime(18872): FATAL EXCEPTION: main
04-23 17:04:18.890: E/AndroidRuntime(18872): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.b6q9.passmanage/com.shai.manage.activity.MainActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: false
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2079)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.ActivityThread.access$600(ActivityThread.java:132)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Handler.dispatchMessage(Handler.java:99)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Looper.loop(Looper.java:137)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.ActivityThread.main(ActivityThread.java:4575)
04-23 17:04:18.890: E/AndroidRuntime(18872): at java.lang.reflect.Method.invokeNative(Native Method)
04-23 17:04:18.890: E/AndroidRuntime(18872): at java.lang.reflect.Method.invoke(Method.java:511)
04-23 17:04:18.890: E/AndroidRuntime(18872): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
04-23 17:04:18.890: E/AndroidRuntime(18872): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
04-23 17:04:18.890: E/AndroidRuntime(18872): at dalvik.system.NativeStart.main(Native Method)
04-23 17:04:18.890: E/AndroidRuntime(18872): Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: false
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Parcel.readParcelable(Parcel.java:1966)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.view.AbsSavedState.
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.view.View$BaseSavedState.
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.view.ext.SatelliteMenu$SavedState.
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.view.ext.SatelliteMenu$SavedState$1.createFromParcel(SatelliteMenu.java:573)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.view.ext.SatelliteMenu$SavedState$1.createFromParcel(SatelliteMenu.java:1)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Parcel.readParcelable(Parcel.java:1992)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Parcel.readValue(Parcel.java:1854)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Parcel.readSparseArrayInternal(Parcel.java:2123)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Parcel.readSparseArray(Parcel.java:1576)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Parcel.readValue(Parcel.java:1911)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Parcel.readMapInternal(Parcel.java:2094)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Bundle.unparcel(Bundle.java:223)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.os.Bundle.getSparseParcelableArray(Bundle.java:1225)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:766)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1014)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:1764)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.Activity.onCreate(Activity.java:864)
04-23 17:04:18.890: E/AndroidRuntime(18872): at com.slidingmenu.lib.app.SlidingActivity.onCreate(SlidingActivity.java:20)
04-23 17:04:18.890: E/AndroidRuntime(18872): at com.shai.manage.activity.MainActivity.onCreate(MainActivity.java:48)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.Activity.performCreate(Activity.java:4465)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-23 17:04:18.890: E/AndroidRuntime(18872): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2033)
04-23 17:04:18.890: E/AndroidRuntime(18872): ... 11 more
这个错误发生在ANDROID SDK Tool 更新到22.6.2时,突然发生的,不知道是不是与这个相关
主要问题是出现在保存 VIEW 状态时出错 自定义VIEW类里实现了Parcelable 接口
extends BaseSavedState
static class SavedState extends BaseSavedState {
boolean rotated;
private float totalSpacingDegree;
private int satelliteDistance;
private int measureDiff;
private int expandDuration;
private boolean closeItemsOnClick;
SavedState(Parcelable superState) {
super(superState);
System.out.println("1 "+superState);
}
public SavedState(Parcel in) {
super(in);
rotated = Boolean.valueOf(in.readString());
totalSpacingDegree = in.readFloat();
satelliteDistance = in.readInt();
measureDiff = in.readInt();
expandDuration = in.readInt();
closeItemsOnClick = Boolean.valueOf(in.readString());
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeString(Boolean.toString(rotated));
out.writeFloat(totalSpacingDegree);
out.writeInt(satelliteDistance);
out.writeInt(measureDiff);
out.writeInt(expandDuration);
out.writeString(Boolean.toString(closeItemsOnClick));
}
public static final Parcelable.Creator
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}
问题出现在没有加入这行代码 super.writeToParcel(out, flags);