DialogFragment show()如何防止Can not perform this action after onSaveInstanceState
普通的fragment 可以使用commitallowstatsloss
普通的fragment 可以使用commitallowstatsloss
DialogFragment 如何防止
DialogParent dialogTag = (DialogParent) getSupportFragmentManager().findFragmentByTag("dialog_event");
final DialogParent dialogParent = (dialogTag == null ? DialogParent.getInstance(dialog) : dialogTag);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
if (dialogTag == null) {
dialogParent.setCancelable(false);
transaction.add(dialogParent, "dialog_event");
transaction.commitAllowingStateLoss();
}
transaction.show(dialogParent);