Xamarin – Alert Dialogs in Android
In this post we would see how to display alerts, and we would see some customization.
We would see two types of Alerts, such as a simple alert which has a message, a title, and a button. And a complex alert which would have a title, a message, but three buttons.
Let’s add two buttons for that purpose.
Now in the Activity1.cs, we would get the button controls and subscribe to their click events.
Now on SimpleDialogClick event handler, we would do the following to display a simple dialog.
And on ComplexDialogClick event handler, we would do the following to display the other two buttons.
Here the first button could be used for positive feedback, second button for negative feedback and the third button for canceling the operation.
Let’s run the app and here are the two alert dialogs.
Hope this quick post helps you, thanks for reading.
Full Source Code: Click Here