I just wanted to understand if my method has some code that shows an alert dialog and after that some other code, then when the alert dialog is shown and I have not clicked any button, will my code below the alert dialog.show() line wait for the dialog to cancel or it will simply be executed without waiting for the response from the alert dialog? Please help me understand this.
AlertDialog.Builder builder = new AlertDialog.Builder(ShowLog.this);
builder.setMessage("Do you really want to delete the "+size+" records?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Doing some work
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
SomeWork();
Somework1();
I want to know when SomeWork(); will be executed. Is it just after showing the alert dialog or after clicking Yes or No of the alert dialog?