From an Activity, I call my method to add a new fragment:
protected void addFragment(@NonNull Fragment fragment,
                               @NonNull String fragmentTag,
                               int containerViewId, int enterAnim, int exitAnim,
                               int popEnterAnim, int popExitAnim) {
        FragmentTransaction transaction = getSupportFragmentManager()
                .beginTransaction()
                .setCustomAnimations(enterAnim, exitAnim, popEnterAnim, popExitAnim)
                .add(containerViewId, fragment, fragmentTag);
        transaction = transaction.addToBackStack(null);             
        transaction.commit();
    }
Most of cases all is perfect, but very rarely there is a crash (detected by Crashlytics):
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:2044) at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:2067) at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:680) at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:634) at com.compagny.ui.BaseActivity.addFragment(BaseActivity.java:1495) at com.compagny.ui.BaseActivity.addFragment(BaseActivity.java:1472) at com.compagny.ui.training.TrainingActivity.setupView(TrainingActivity.java:309)
I don't know why; have you got some suggestions for my investigation guys?
Thank you very much!
 
     
    