由于快速按下按钮而导致崩溃

时间:2013-04-06 05:49:31

标签: android android-fragments

当我按一下后退按钮时,应用程序退出就好了。但是当我反复快速按下[Back]按钮时,应用程序崩溃(参见附加的堆栈跟踪)。即使没有执行任何片段事务也会发生。有治疗方法吗?

04-06 05:41:50.436: E/AndroidRuntime(2352): FATAL EXCEPTION: main
04-06 05:41:50.436: E/AndroidRuntime(2352): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1327)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:475)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:174)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.app.Activity.onKeyUp(Activity.java:2145)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.view.KeyEvent.dispatch(KeyEvent.java:2633)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.app.Activity.dispatchKeyEvent(Activity.java:2375)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1847)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3701)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3651)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2818)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.os.Looper.loop(Looper.java:137)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at android.app.ActivityThread.main(ActivityThread.java:5041)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at java.lang.reflect.Method.invokeNative(Native Method)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at java.lang.reflect.Method.invoke(Method.java:511)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-06 05:41:50.436: E/AndroidRuntime(2352):     at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

弄清楚我的愚蠢错误。我在覆盖活动的super.onStop()时呼叫onPause()