Lingua

AlertDialog Constructors

Definition

Overloads

Name Description
AlertDialog(Context)

Creates an alert dialog that uses the default alert dialog theme.

AlertDialog(Context, Int32)

Creates an alert dialog that uses an explicit theme resource.

AlertDialog(IntPtr, JniHandleOwnership)

Initializes a managed representation of an existing Java Native Interface object.

AlertDialog(Context, Boolean, IDialogInterfaceOnCancelListener)

Creates an alert dialog that uses the default alert dialog theme and a custom cancel listener.

AlertDialog(Context, Boolean, EventHandler)

AlertDialog(Context)

Creates an alert dialog that uses the default alert dialog theme.

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")]
protected AlertDialog(Android.Content.Context? context);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")>]
new Android.App.AlertDialog : Android.Content.Context -> Android.App.AlertDialog

Parameters

context
Context

the parent context

Attributes

Remarks

Creates an alert dialog that uses the default alert dialog theme. The default alert dialog theme is defined by R.attr.alertDialogTheme within the parent context's theme.

See also:

Android reference for android.app.AlertDialog.AlertDialog.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AlertDialog(Context, Int32)

Creates an alert dialog that uses an explicit theme resource.

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;I)V", "")]
protected AlertDialog(Android.Content.Context? context, int themeResId);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;I)V", "")>]
new Android.App.AlertDialog : Android.Content.Context * int -> Android.App.AlertDialog

Parameters

context
Context

the parent context

themeResId
Int32

the resource ID of the theme against which to inflate this dialog, or 0 to use the parent context's default alert dialog theme

Attributes

Remarks

Creates an alert dialog that uses an explicit theme resource. The specified theme resource (themeResId) is applied on top of the parent context's theme. It may be specified as a style resource containing a fully-populated theme, such as R.style.Theme_Material_Dialog, to replace all attributes in the parent context's theme including primary and accent colors. To preserve attributes such as primary and accent colors, the themeResId may instead be specified as an overlay theme such as R.style.ThemeOverlay_Material_Dialog. This will override only the window attributes necessary to style the alert window as a dialog. Alternatively, the themeResId may be specified as 0 to use the parent context's resolved value for R.attr.alertDialogTheme.

See also:

Android reference for android.app.AlertDialog.AlertDialog.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AlertDialog(IntPtr, JniHandleOwnership)

Initializes a managed representation of an existing Java Native Interface object.

protected AlertDialog(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.App.AlertDialog : nativeint * Android.Runtime.JniHandleOwnership -> Android.App.AlertDialog

Parameters

javaReference
IntPtr

nativeint

The Java Native Interface object reference.

transfer
JniHandleOwnership

The ownership transfer to apply to the Java Native Interface object reference.

Remarks

This constructor is called by the .NET for Android binding runtime when it creates a managed peer for an existing Java object.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AlertDialog(Context, Boolean, IDialogInterfaceOnCancelListener)

Creates an alert dialog that uses the default alert dialog theme and a custom cancel listener.

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;ZLandroid/content/DialogInterface$OnCancelListener;)V", "")]
protected AlertDialog(Android.Content.Context? context, bool cancelable, Android.Content.IDialogInterfaceOnCancelListener? cancelListener);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;ZLandroid/content/DialogInterface$OnCancelListener;)V", "")>]
new Android.App.AlertDialog : Android.Content.Context * bool * Android.Content.IDialogInterfaceOnCancelListener -> Android.App.AlertDialog

Parameters

context
Context

Context: the parent context

cancelable
Boolean

boolean

cancelListener
IDialogInterfaceOnCancelListener

DialogInterface.OnCancelListener

Attributes

Remarks

Creates an alert dialog that uses the default alert dialog theme and a custom cancel listener. This is functionally identical to: The default alert dialog theme is defined by R.attr.alertDialogTheme within the parent context's theme.

See also:

Android reference for android.app.AlertDialog.AlertDialog.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AlertDialog(Context, Boolean, EventHandler)

protected AlertDialog(Android.Content.Context context, bool cancelable, EventHandler cancelHandler);
new Android.App.AlertDialog : Android.Content.Context * bool * EventHandler -> Android.App.AlertDialog

Parameters

context
Context
cancelable
Boolean
cancelHandler
EventHandler

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to