How to prevent AlertDialog box from closing down when a button is pressed. E.g. Currently when I press "Got it" button the dialog box closes but I don't want it to close, I want it to keep showing up. Basically, I have a button there but I don't want it to close the AlertDialog when pressed.
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle("Message")
.setMessage("First message")
.setCancelable(true)
.setNegativeButton("Got it", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}});
AlertDialog alert = builder.create();
alert.show();