I have an IllegalStateException
on showing a DialogFragment
:
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
i know why its happening but i want to using commitAllowingStateLoss on showing dialog by overriding DialogFragment show
function :
public void show(FragmentManager manager, String tag) {
mDismissed = false;
mShownByMe = true;
FragmentTransaction ft = manager.beginTransaction();
ft.add(this, tag);
ft.commit(); //replace it by commitAllowingStateLoss
}
but i don't access to mDismissed
and mShownByMe
variables , how can i access those variables to modify them as it's parent did.
I think to prevent throwing IllegalStateException
on DialogFragment
might be better to use :
YourDialogFragment dialogFragment = new YourDialogFragment();
fragmentManager.beginTransaction().add(dialogFragment, YourDialogFragment.TAG_FRAGMENT).commitAllowingStateLoss();
instead of using show()
on DialogFragment
.