java.lang.IllegalStateException: Activity has been destroyed
FragmentManager.java
@OverridepublicvoidpopBackStack(finalint id, finalint flags) {
if (id < 0) {
thrownew IllegalArgumentException("Bad id: " + id);
}
enqueueAction(new Runnable() {
@Overridepublicvoidrun() {
popBackStackState(mHost.getHandler(), null, id, flags);
}
}, false);
}
/**
* Adds an action to the queue of pending actions.
*
* @param action the action to add
* @param allowStateLoss whether to allow loss of state information
* @throws IllegalStateException if the activity has been destroyed
*/publicvoidenqueueAction(Runnable action, boolean allowStateLoss) {
if (!allowStateLoss) {
checkStateLoss();
}
synchronized (this) {
if (mDestroyed || mHost == null) {
thrownew IllegalStateException("Activity has been destroyed");
}
if (mPendingActions == null) {
mPendingActions = new ArrayList<Runnable>();
}
mPendingActions.add(action);
if (mPendingActions.size() == 1) {
mHost.getHandler().removeCallbacks(mExecCommit);
mHost.getHandler().post(mExecCommit);
}
}
}