Example usage for Java android.app AlertDialog.Builder fields, constructors, methods, implement or subclass
The text is from its open source code.
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. |
void | cancel() Cancel the dialog. |
void | create() Forces immediate creation of the dialog. |
void | dismiss() Dismiss this dialog, removing it from the screen. |
T | findViewById(@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() ). |
Context | getContext() Retrieve the Context this Dialog is running in. |
boolean | isShowing() |
void | setButton(CharSequence text, Message msg) |
void | setButton(CharSequence text, final OnClickListener listener) Set a listener to be invoked when button 1 of the dialog is pressed. |
void | setButton2(CharSequence text, Message msg) |
void | setButton2(CharSequence text, final OnClickListener listener) Set a listener to be invoked when button 2 of the dialog is pressed. |
void | setButton3(CharSequence text, Message msg) |
void | setButton3(CharSequence text, final OnClickListener listener) Set a listener to be invoked when button 3 of the dialog is pressed. |
void | setCancelable(boolean flag) Sets whether this dialog is cancelable with the KeyEvent#KEYCODE_BACK BACK key. |
void | setCustomTitle(View customTitleView) |
void | setIcon(@DrawableRes int resId) Set resId to 0 if you don't want an icon. |
void | setIcon(Drawable icon) |
void | setIconAttribute(@AttrRes int attrId) Set an icon as supplied by a theme attribute. |
void | setInverseBackgroundForced(boolean forceInverseBackground) |
void | setMessage(CharSequence message) |
void | setOnCancelListener(@Nullable OnCancelListener listener) Set a listener to be invoked when the dialog is canceled. |
void | setOnDismissListener(@Nullable OnDismissListener listener) Set a listener to be invoked when the dialog is dismissed. |
void | setOnKeyListener(@Nullable OnKeyListener onKeyListener) Sets the callback that will be called if a key is dispatched to the dialog. |
void | setTitle(CharSequence title) |
void | setView(View view) Set the view to display in that dialog. |
void | setView(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. |
void | show() Start the dialog and display it on screen. |