3

this stacktrace was submitted to my project issue tracker. As you there is no references to my code, so does anybody know how to fix it? I'm using support library v19.0.1 and I can provide more details about device/platform if need


java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
        at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1343)
        at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:486)
        at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:179)
        at android.support.v7.app.ActionBarActivity.onBackPressed(ActionBarActivity.java:250)
        at android.app.Activity.onKeyUp(Activity.java:2099)
        at android.view.KeyEvent.dispatch(KeyEvent.java:2575)
        at android.app.Activity.dispatchKeyEvent(Activity.java:2329)
        at android.support.v7.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchKeyEvent(ActionBarActivityDelegateICS.java:250)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1806)
        at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3344)
        at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3317)
        at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2464)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4424)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)
IvanP
  • 1,064
  • 13
  • 16
  • which is the API level of the device/emulator – Pararth Feb 10 '14 at 06:41
  • 1
    http://stackoverflow.com/questions/7469082/getting-exception-illegalstateexception-can-not-perform-this-action-after-onsa/10261438#10261438 – Pararth Feb 10 '14 at 06:43
  • it is the real device with API level 15. I am not using Fragments, I even don't call onSaveInstanceState anywhere in my project – IvanP Feb 10 '14 at 12:28

1 Answers1

0

First change i made is

 getSupportFragmentManager().beginTransaction()
.add(R.id.container,new CatListFragment(null)).commitAllowingStateLoss();

Second change is intercept onPause onStop and onResume for the activity, maintain a flag if application is in paused state(or any other way). Intention is not to call .commit() or .commitAllowingStateLoss() in paused state. Once app is resumed you can call the FragmentManager commit. Worked for me :)

Deepak Patil
  • 3,419
  • 3
  • 25
  • 22