is
if (isStateSaved()) {
commitAllowingStateLoss()
} else {
commit()
}
same as
commitAllowingStateLoss()
As the method internals are the same with only diff of throwing IllegalStateException?
If yes, then why in this fragment helper made by vasiliy he does so :
private void commitFragmentTransactionSafely(FragmentTransaction ft) {
// TODO: add mechanism for notifications about commits that allow state loss
if (mFragmentManager.isStateSaved()) {
// We acknowledge the possibility of losing this transaction if the app undergoes
// save&restore flow after it is committed.
ft.commitAllowingStateLoss();
} else {
ft.commit();
}
}
and rclone guys also do this : https://github.com/x0b/rcx/blob/master/app/src/main/java/ca/pkay/rcloneexplorer/Dialogs/Dialogs.java