I'm facing some crashes in my application with the following stacktrace:
Fatal Exception: java.lang.IllegalStateException: Activity has been destroyed
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1560)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:696)
at android.support.v4.app.BackStackRecord.commitAllowingStateLoss(BackStackRecord.java:667)
at ....activities.MyActivity.replaceContentFragment(MyActivity.java:293)
This only happens for activities where I load content asynchronously from web and the replace the according fragment. I don't understand how the activity can be gone as the user cannot change fragments/activities while loading. I guess it must have to do with leaving/starting the app while loading (although I may be wrong about this).
My activities do have launchMode = singletask
, maybe that's related as well.
The crashes appear on Android 6.0.1, but maybe that's due to the fact that the users mostly have that version...