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

前端 未结 7 505
情话喂你
情话喂你 2020-12-13 04:41

Implementing an app where the user can log in I have the following situation: If the user is logged in perform the action else start the login activity for result and if the

7条回答
  •  春和景丽
    2020-12-13 04:52

    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);
            }
        });        
    }
    

提交回复
热议问题