Actions in onActivityResult and "Error Can not perform this action after onSaveInstanceState" Actions in onActivityResult and "Error Can not perform this action after onSaveInstanceState" java java

Actions in onActivityResult and "Error Can not perform this action after onSaveInstanceState"


Best thing I've come up with is to not use .show() but rather do this.

CheckinSuccessDialog dialog = new CheckinSuccessDialog();//dialog.show(getSupportFragmentManager(), null);FragmentTransaction ft = getSupportFragmentManager().beginTransaction();ft.add(dialog, null);ft.commitAllowingStateLoss();


Here is the workaround that works fine for me.

private void alert(final String message) {    Handler handler = new Handler(Looper.getMainLooper());    handler.post(new Runnable() {        public void run() {            AlertDialogFragment alertDialogFragment = AlertDialogFragment.newInstance(message);            alertDialogFragment.show(getFragmentManager(), ALERT_DIALOG_FRAGMENT);        }    });        }


If using a DialogFragment, the only thing that worked for me was to dismiss the Fragment with dissmissAllowingStateLoss()