how to add two alertdialog button in android

0 712

 alert dialog button in android

In this tut, I will show you how you can add two buttons in an alert dialog.For two alertdialog button In main activity.java  we have one onclick method Showalert .in this method we have used AlertDialog.Builder to create our dialog box interface this interface shows us buttons and title with message.

activity_mian.xml

In activity_mian.xml we have a one simple xml layout which contain a Button and onClick attribute.

string.xml

In string.xml we have two string values appname and Label to define app name and label for a button.

Download source code

 

Comments

comments

Leave A Reply

Your email address will not be published.