Builder

constructor(@NonNull context: @NonNull Context)(source)

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

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

Parameters

context

the parent context


constructor(@NonNull context: @NonNull Context, @StyleRes themeResId: Int)(source)

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 Theme_AppCompat_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 ThemeOverlay_AppCompat_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 alertDialogTheme.

Parameters

context

the parent context

themeResId

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