simple yes no dialog android default java

Solutions on MaxInterview for simple yes no dialog android default java by the best coders in the world

showing results for - "simple yes no dialog android default java"
Rajesh
03 Jan 2020
1DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
2    @Override
3    public void onClick(DialogInterface dialog, int which) {
4        switch (which){
5        case DialogInterface.BUTTON_POSITIVE:
6            //Yes button clicked
7            break;
8
9        case DialogInterface.BUTTON_NEGATIVE:
10            //No button clicked
11            break;
12        }
13    }
14};
15
16AlertDialog.Builder builder = new AlertDialog.Builder(context);
17builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
18    .setNegativeButton("No", dialogClickListener).show();
19