AlertDialog.Builder Constructors

Definition

Overloads

AlertDialog.Builder(Context)

Creates a builder for an alert dialog that uses the default alert dialog theme.

AlertDialog.Builder(Context, Int32)

Creates a builder for an alert dialog that uses an explicit theme resource.

AlertDialog.Builder(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

AlertDialog.Builder(Context)

Creates a builder for an alert dialog that uses the default alert dialog theme.

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

Parameters

context
Context

the parent context

Attributes

Remarks

Creates a builder for an alert dialog that uses the default alert dialog theme.

The default alert dialog theme is defined by android.R.attr#alertDialogTheme within the parent context's theme.

Java documentation for android.app.AlertDialog.Builder.AlertDialog$Builder(android.content.Context).

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.Builder(Context, Int32)

Creates a builder for an alert dialog that uses an explicit theme resource.

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

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 a builder for 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 android.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 android.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 android.R.attr#alertDialogTheme.

Java documentation for android.app.AlertDialog.Builder.AlertDialog$Builder(android.content.Context, int).

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.Builder(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

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

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

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