Answers for "simple yes no dialog android default java"

0

simple yes no dialog android default java

DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
        switch (which){
        case DialogInterface.BUTTON_POSITIVE:
            //Yes button clicked
            break;

        case DialogInterface.BUTTON_NEGATIVE:
            //No button clicked
            break;
        }
    }
};

AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
    .setNegativeButton("No", dialogClickListener).show();
Posted by: Guest on June-09-2021

Code answers related to "simple yes no dialog android default java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language