这仅在活动在后台播放一段时间后才会发生。如果我按“主页”按钮然后几秒钟后重新打开应用程序,恢复之前的状态,不会发生。当我按下“主页”按钮然后一小时后重新打开应用程序,尝试恢复之前的状态时,会发生。
我认为WIN DEATH正在造成它。我认为这是垃圾收集的活动,但我不确定为什么它不会重新启动。
有关为何发生这种情况的任何见解?
注意:游戏实现了Parcelable
05-22 20:43:14.343 I/ActivityManager(401): Start proc com.example.test for activity com.example.test/.ui.MainActivity: pid=12767 uid=10117 gids={50117, 3003, 1028} 05-22 20:48:22.914 I/ActivityManager(401): 43942 kB: com.example.test (pid 12767) 05-22 20:48:22.914 I/ActivityManager(401): 12767 62632K 62488K 44006K 40068K com.example.test 05-22 20:58:39.593 I/WindowState(401): WIN DEATH: Window{41b13370 u0 com.example.test/com.example.test.ui.MainActivity} 05-22 20:58:39.593 I/ActivityManager(401): Process com.example.test (pid 12767) has died. 05-23 11:12:25.469 I/ActivityManager(401): Start proc com.example.test for activity com.example.test/.ui.MainActivity: pid=6450 uid=10117 gids={50117, 3003, 1028} 05-23 11:12:25.696 E/AndroidRuntime(6450): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test/com.example.test.ui.MainActivity}: java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.util.ArrayList[] 05-23 11:12:25.696 E/AndroidRuntime(6450): at com.example.test.model.Game.(Game.java:241) 05-23 11:12:25.696 E/AndroidRuntime(6450): at com.example.test.model.Game.(Game.java:235) 05-23 11:12:25.696 E/AndroidRuntime(6450): at com.example.test.model.Game$1.createFromParcel(Game.java:228) 05-23 11:12:25.696 E/AndroidRuntime(6450): at com.example.test.model.Game$1.createFromParcel(Game.java:1) 05-23 11:12:25.696 E/AndroidRuntime(6450): at com.example.test.ui.MainActivity.onCreate(MainActivity.java:237) 05-23 11:12:25.798 W/ActivityManager(401): Force finishing activity com.example.test/.ui.MainActivity 05-23 11:12:26.352 W/ActivityManager(401): Activity pause timeout for ActivityRecord{4161a520 u0 com.example.test/.ui.MainActivity} 05-23 11:12:27.438 I/ActivityManager(401): Process com.example.test (pid 6450) has died.