i've seen this too. I got around it by overriding the problematic View's onRestoreInstanceState method:
public void onRestoreInstanceState(Bundle savedState) { ... ... super.onRestoreInstanceState(BaseSavedState.EMPTY_STATE); } I took a look at the android.view.View's implementation of this onRestoreInstanceState method and it only expects the BaseSavedState.EMPTY_STATE as valid input. It checks for if (savedState != BaseSavedState.EMPTY_STATE) then throw exception ... For me it went wrong because 'savedState' is no longer the actual BaseSavedState.EMPTY_STATE instance but a de-serialized copy of it (after the killed process has been restored/restarted) and this means that the '!=' operator returns true and an exception is thrown. On Nov 24, 10:08 am, Mark Wyszomierski <mar...@gmail.com> wrote: > Hi, > > I'm testing how my app behaves when killed by the OS due to low memory > conditions. I always have three activities on the stack, like: > > A B C (then C launches maps or some other heavy process) > > when my app is killed, and I return to it, C starts itself up again > ok. When I hit the back button to go to B, I [sometimes] get an > exception thrown which I can't trace. Output is below. I don't know > where to go from here. I've only seen one other post mentioning this > exception, but it was related to a reproducable error when rotating > the device. This only happens sometimes. Thanks for any help: > > 11-24 07:52:12.469: ERROR/AndroidRuntime(5877): Uncaught handler: > thread main exiting due to uncaught exception > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): > java.lang.RuntimeException: Unable to start activity ComponentInfo > {com.test.android/com.test.android.ui.ActivityHello}: > java.lang.IllegalArgumentException: Wrong state class -- expecting > View State > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2268) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > 2284) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.ActivityThread.access$1800(ActivityThread.java:112) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.os.Handler.dispatchMessage(Handler.java:99) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.os.Looper.loop(Looper.java:123) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.ActivityThread.main(ActivityThread.java:3948) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > java.lang.reflect.Method.invokeNative(Native Method) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > java.lang.reflect.Method.invoke(Method.java:521) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run > (ZygoteInit.java:782) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > dalvik.system.NativeStart.main(Native Method) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): Caused by: > java.lang.IllegalArgumentException: Wrong state class -- expecting > View State > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.View.onRestoreInstanceState(View.java:5359) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.View.dispatchRestoreInstanceState(View.java:5335) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java: > 1093) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java: > 1097) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java: > 1097) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java: > 1097) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java: > 1097) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.view.View.restoreHierarchyState(View.java:5314) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState > (PhoneWindow.java:1501) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.Activity.onRestoreInstanceState(Activity.java:834) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.Activity.performRestoreInstanceState(Activity.java:800) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.Instrumentation.callActivityOnRestoreInstanceState > (Instrumentation.java:1172) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2245) > 11-24 07:52:12.539: ERROR/AndroidRuntime(5877): ... 11 more -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en