java.lang.IllegalStateException: FragmentManager is already executing transactions
I've read all StackOverflow questions about that, and nothing helped. Just wanted to share my experience
public void onResume() {
super.onResume()
if(condition) replaceFragment()
}
public void replaceFragment() {
if (fragmentName != null && !this.isDestroyed()) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(container_id, FragmentInstantiate());
ft.commitAllowingStateLoss();
}
}
it is commit()/commitAllowingStateLoss() that caused IllegalStateException: FragmentManager is already executing transactions. NOT commitNow() or executePendingTransactions()