I have an activity with below layout
maybe your can encapture commition of FragmentTransaction like this
private void commitFragmentTransaction(final FragmentTransaction ft, boolean allowStateLoss, boolean now) {
if (ft == null || ft.isEmpty()) {
return;
}
if (allowStateLoss) {
if (now) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
ft.commitNowAllowingStateLoss();
} else {
ft.commitAllowingStateLoss();
mFragmentManager.executePendingTransactions();
}
} else {
ft.commitAllowingStateLoss();
}
} else {
if (now) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
ft.commitNow();
} else {
ft.commit();
mFragmentManager.executePendingTransactions();
}
} else {
ft.commit();
}
}
}
commitNow() and commitNowAllowingStateLoss() is Added in API level 24
Calling commitNow is preferable to calling commit() followed by executePendingTransactions() as the latter will have the side effect of attempting to commit all currently pending transactions whether that is the desired behavior or not.