Android: How to override onBackPressed() in AlertDialog?

后端 未结 4 1401
[愿得一人]
[愿得一人] 2021-02-05 04:30

I have an AlertDialog dlgDetails which is shown from another AlertDialog dlgMenu. I would like to be able to show dlgMenu again if the user presses the

4条回答
  •  感情败类
    2021-02-05 04:54

    Found a shorter solution :) try this:

             accountDialog = builder.create();
    
            accountDialog.setOnCancelListener(new OnCancelListener() {
    
                @Override
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                    activity.finish();
    
                }
            });
    

提交回复
热议问题