added in version 24.1.0
belongs to Maven artifact com.android.support:appcompat-v7:28.0.0-alpha1

AlertDialog.Builder

public static class AlertDialog.Builder
extends Object

java.lang.Object
   ↳ android.support.v7.app.AlertDialog.Builder


Summary

Public constructors

AlertDialog.Builder(Context context)

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

AlertDialog.Builder(Context context, int themeResId)

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

Public methods

AlertDialog create()

Creates an AlertDialog with the arguments supplied to this builder.

Context getContext()

Returns a Context with the appropriate theme for dialogs created by this Builder.

AlertDialog.Builder setAdapter(ListAdapter adapter, DialogInterface.OnClickListener listener)

Set a list of items, which are supplied by the given ListAdapter, to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

AlertDialog.Builder setCancelable(boolean cancelable)

Sets whether the dialog is cancelable or not.

AlertDialog.Builder setCursor(Cursor cursor, DialogInterface.OnClickListener listener, String labelColumn)

Set a list of items, which are supplied by the given Cursor, to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

AlertDialog.Builder setCustomTitle(View customTitleView)

Set the title using the custom view customTitleView.

AlertDialog.Builder setIcon(Drawable icon)

Set the Drawable to be used in the title.

AlertDialog.Builder setIcon(int iconId)

Set the resource id of the Drawable to be used in the title.

AlertDialog.Builder setIconAttribute(int attrId)

Set an icon as supplied by a theme attribute.

AlertDialog.Builder setInverseBackgroundForced(boolean useInverseBackground)

This method was deprecated in API level 24.1.0. This flag is only used for pre-Material themes. Instead, specify the window background using on the alert dialog theme.

AlertDialog.Builder setItems(int itemsId, DialogInterface.OnClickListener listener)

Set a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

AlertDialog.Builder setItems(CharSequence[] items, DialogInterface.OnClickListener listener)

Set a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

AlertDialog.Builder setMessage(int messageId)

Set the message to display using the given resource id.

AlertDialog.Builder setMessage(CharSequence message)

Set the message to display.

AlertDialog.Builder setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener)

Set a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

AlertDialog.Builder