Java android.app AlertDialog.Builder fields, constructors, methods, implement or subclass

Example usage for Java android.app AlertDialog.Builder fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.app AlertDialog.Builder.

The text is from its open source code.

Subclass

android.app.AlertDialog.Builder has subclasses.
Click this link to see all its subclasses.

Constructor

Builder(Context context)
Creates a builder for an alert dialog that uses the default alert dialog theme.
Builder(Context context, int themeResId)
Creates a builder for an alert dialog that uses an explicit theme resource.

Method

voidcancel()
Cancel the dialog.
voidcreate()
Forces immediate creation of the dialog.
voiddismiss()
Dismiss this dialog, removing it from the screen.
TfindViewById(@IdRes int id)
Finds the first descendant view with the given ID or null if the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not yet been fully created (for example, via #show() or #create() ).
ContextgetContext()
Retrieve the Context this Dialog is running in.
booleanisShowing()
voidsetButton(CharSequence text, Message msg)
voidsetButton(CharSequence text, final OnClickListener listener)
Set a listener to be invoked when button 1 of the dialog is pressed.
voidsetButton2(CharSequence text, Message msg)
voidsetButton2(CharSequence text, final OnClickListener listener)
Set a listener to be invoked when button 2 of the dialog is pressed.
voidsetButton3(CharSequence text, Message msg)
voidsetButton3(CharSequence text, final OnClickListener listener)
Set a listener to be invoked when button 3 of the dialog is pressed.
voidsetCancelable(boolean flag)
Sets whether this dialog is cancelable with the KeyEvent#KEYCODE_BACK BACK key.
voidsetCustomTitle(View customTitleView)
voidsetIcon(@DrawableRes int resId)
Set resId to 0 if you don't want an icon.
voidsetIcon(Drawable icon)
voidsetIconAttribute(@AttrRes int attrId)
Set an icon as supplied by a theme attribute.
voidsetInverseBackgroundForced(boolean forceInverseBackground)
voidsetMessage(CharSequence message)
voidsetOnCancelListener(@Nullable OnCancelListener listener)
Set a listener to be invoked when the dialog is canceled.
voidsetOnDismissListener(@Nullable OnDismissListener listener)
Set a listener to be invoked when the dialog is dismissed.
voidsetOnKeyListener(@Nullable OnKeyListener onKeyListener)
Sets the callback that will be called if a key is dispatched to the dialog.
voidsetTitle(CharSequence title)
voidsetView(View view)
Set the view to display in that dialog.
voidsetView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom)
Set the view to display in that dialog, specifying the spacing to appear around that view.
voidshow()
Start the dialog and display it on screen.