A Basic Alert Dialog

suggest change
AlertDialog.Builder builder = new AlertDialog.Builder(context);
//Set Title
        //Set Message
        .setMessage("Are you sure?")
        //Set the icon of the dialog
        //Set the positive button, in this case, OK, which will dismiss the dialog and do everything in the onClick method
        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialogInterface, int i) {
                // Reset
AlertDialog dialog = builder.create();
//Now, any time you can call on:
//So you can show the dialog.

Now this code will achieve this:

(Image source: WikiHow)

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents