Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #simple #dialog #android #default #java
ADD COMMENT
Topic
Name
3+8 =