java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

google.com | 2 weeks ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael and Rafael Fischer Viola . Or join the community to write better ones.
  1. 0
    samebug tip
    When you use findViewById inside an activity it is going to look for a View inside your main_activity.xml. If it's not there, it throws this exception, try to use the right view to call findviewById.
  2. 0
    samebug tip
    If you're using nested fragments, you have to use childFragmentManager instead of fragmentManager.
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0
    samebug tip
    Check if you imported android.support.v4.app.FragmentManager and not android.app.FragmentManager. Check for naming problems in your xml files as well, might have inconsistencies!
  5. 0
    samebug tip
    Also, check if you're not using android.support.v4.app.FragmentTransaction with android.app.Fragment, as they're not totally compatible.
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    Can not perform this action after onSaveInstanceState

    at android.support.v4.app.FragmentManagerImpl.checkStateLoss()
  2. Android Support v4
    BackStackRecord.commit
    1. android.support.v4.app.FragmentManagerImpl.checkStateLoss(SourceFile:1493)
    2. android.support.v4.app.FragmentManagerImpl.enqueueAction(SourceFile:1511)
    3. android.support.v4.app.BackStackRecord.commitInternal(SourceFile:634)
    4. android.support.v4.app.BackStackRecord.commit(SourceFile:613)
    4 frames
  3. com.my.package
    LoginFragment1$1.onClick
    1. com.my.package.ui.activities.LoginActivity.onRegisterClicked(SourceFile:94)
    2. com.my.package.ui.fragments.LoginFragment1$1.onClick(SourceFile:114)
    2 frames
  4. Android Platform
    ActivityThread.main
    1. android.view.View.performClick(View.java:4278)
    2. android.view.View$PerformClick.run(View.java:17430)
    3. android.os.Handler.handleCallback(Handler.java:725)
    4. android.os.Handler.dispatchMessage(Handler.java:92)
    5. android.os.Looper.loop(Looper.java:213)
    6. android.app.ActivityThread.main(ActivityThread.java:5092)
    6 frames
  5. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Method.java)
    2. java.lang.reflect.Method.invoke(Method.java:511)
    2 frames
  6. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
    2 frames
  7. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(NativeStart.java)
    1 frame