I use showDialog
and dismissDialog
in activity to display and destroy my dialog. Is there also a way to issue a click command on the currently disp
If you are using Builder, it's doesn't have the getButton() function. You can try this one
AlertDialog.Builder alBuilder = new AlertDialog.Builder(this);
alBuilder.setMessage("Test Message")
.setPositiveButton("Yes", null)
.setNegativeButton("No",null)
alBuilder.setCancelable(false);
AlertDialog alertDialog = alBuilder.show();
Then you can access the button by below code
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();