I made a very simple Activity which shows a simple ListFragment like below:
My Activity:
public class MyActivity ex
I also faced a similar problem.
I realized that this happened because the activity was being destroyed while the FragmentTransaction
was about to get .commit()
.
A solution to this was to check whether the Activity.isFinishing()
is true or not.
if (!isFinishing()) {
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
ft.replace(SOME_RES_ID, myFragmentInstance);
ft.commit();
}