Reputation: 701
Can I set an onclickListner
for AlertDialog
?
Upvotes: 0
Views: 667
Reputation: 1576
There are three types of button in AlertDialog: positive button, negative button and neutral button. You can set click listener for each of them. AlertDialog.Builder provides a easy way to create AlertDialog, and apis to let you set listeners for those three buttons which I just mentioned. These listeners must implements DialogInterface.OnClickListener
.
Following are three methods you can use to set listeners for dialog buttons:
Upvotes: 3