Display Yes/No Dialog Box in Android – AlertDialog.Builder

If you want to show a Yes/No Dialog Box in Android then you use the following method. You can learn more about AlertDialog.Builder y visiting this link.Courtesy- stackoverflow.com

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(this);
builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
    .setNegativeButton("No", dialogClickListener).show();

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us