Xamarin.Android Dialogs

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Parameters

commonly used Public MethodUse
SetTitle(String)Sets Title for the dialog
SetIcon(Drawable)Set Icon for the alert dialog
SetMessage(string)Set the message to display.
SetNegativeButton(String, EventHandler)Set a listener to be invoked when the negative button of the dialog is pressed.
SetPositiveButton(String, EventHandler)Set a listener to be invoked when the positive button of the dialog is pressed.
SetNeutralButton(String, EventHandler)Set a listener to be invoked when the neutral button of the dialog is pressed.
SetOnCancelListener(IDialogInterfaceOnCancelListener)Sets the callback that will be called if the dialog is canceled.
SetOnDismissListener(IDialogInterfaceOnDismissListener)Sets the callback that will be called when the dialog is dismissed for any reason.
Show()Creates a AlertDialog with the arguments supplied to this builder and Dialog.Show's the dialog.

Remarks


Requirements

Namespace: Android.App

Assembly: Mono.Android (in Mono.Android.dll)

Assembly Versions: 0.0.0.0


Public Constructors

AlertDialog.Builder(Context) :-

Constructor using a context for this builder and the AlertDialog it creates.

AlertDialog.Builder(Context, Int32) :-

Constructor using a context and theme for this builder and the AlertDialog it creates.


Using Material Design AlertDialog

In order to use the modern AlertDialog:

  1. Install Support v7 AppCompat library from the NuGet packages
  2. Replace AlertDialog with Android.Support.V7.App.AlertDialog or add the following statement at the top to make your dialog shine.
        using AlertDialog = Android.Support.V7.App.AlertDialog;


Got any Xamarin.Android Question?