Activity按返回键时有时会出异常
Activity按返回键时有时会出异常,概率不高,如何解决?Thread [<1> main] (Suspended (exception IllegalStateException))
<VM does not provide monitor information>
FragmentManagerImpl.checkStateLoss() line: 1265
FragmentManagerImpl.popBackStackImmediate() line: 451
TestActivity(Activity).onBackPressed() line: 2127
TestActivity(Activity).onKeyUp(int, KeyEvent) line: 2105
KeyEvent.dispatch(KeyEvent$Callback, KeyEvent$DispatcherState, Object) line: 2575
TestActivity(Activity).dispatchKeyEvent(KeyEvent) line: 2335
PhoneWindow$DecorView.dispatchKeyEvent(KeyEvent) line: 1829
RelativeLayout(ViewGroup).dispatchKeyEvent(KeyEvent) line: 1246
RelativeLayout(ViewGroup).dispatchKeyEvent(KeyEvent) line: 1246
FrameLayout(ViewGroup).dispatchKeyEvent(KeyEvent) line: 1246
LinearLayout(ViewGroup).dispatchKeyEvent(KeyEvent) line: 1246
PhoneWindow$DecorView(ViewGroup).dispatchKeyEvent(KeyEvent) line: 1246
PhoneWindow$DecorView.superDispatchKeyEvent(KeyEvent) line: 1902
PhoneWindow.superDispatchKeyEvent(KeyEvent) line: 1381
MainActivity(Activity).dispatchKeyEvent(KeyEvent) line: 2330
PhoneWindow$DecorView.dispatchKeyEvent(KeyEvent) line: 1829
ViewRootImpl.deliverKeyEventPostIme(KeyEvent, boolean) line: 3356
ViewRootImpl.handleFinishedEvent(int, boolean) line: 3329
ViewRootImpl.handleMessage(Message) line: 2465
ViewRootImpl(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 137
ActivityThread.main(String[]) line: 4439
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 511
ZygoteInit$MethodAndArgsCaller.run() line: 787
ZygoteInit.main(String[]) line: 554
NativeStart.main(String[]) line: not available [native method] --------------------编程问答-------------------- 你这个是在模拟器上测试的? 一般很少出现这个情况。
你检查一下你的代码,在back的时候做了什么操作。
补充:移动开发 , Android