I made a very simple Activity which shows a simple ListFragment like below:
My Activity:
public class MyActivity ex
Still bad, because got error “Activity has been destroyed”
ava.lang.IllegalStateException: Activity has been destroyed fragmentTransaction.commitAllowingStateLoss();
So my solution is add check if (!isFinishing()&&!isDestroyed())
if (!isFinishing()&&!isDestroyed()) {
fragmentTransaction.commitAllowingStateLoss();
}
}