Added in API level 1

AlertDialog


open class AlertDialog : Dialog, DialogInterface
DatePickerDialog

A simple dialog containing an android.widget.DatePicker.

ProgressDialog

A dialog showing a progress indicator and an optional text message or view.

TimePickerDialog

A dialog that prompts the user for the time of day using a TimePicker.

A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. If you want to display a more complex view, look up the FrameLayout called "custom" and add your view to it:

FrameLayout fl = findViewById(android.R.id.custom);
  fl.addView(myView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
  

The AlertDialog class takes care of automatically setting WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM for you based on whether any views in the dialog return true from View.onCheckIsTextEditor(). Generally you want this set for a Dialog without text editors, so that it will be placed on top of the current input method UI. You can modify this behavior by forcing the flag to your desired mode after calling onCreate.

Summary

Nested classes
open

Constants
static Int

Special theme constant for AlertDialog(android.content.Context,int): use the device's default alert theme with a dark background.

static Int

Special theme constant for AlertDialog(android.content.Context,int): use the device's default alert theme with a light background.

static Int

Special theme constant for AlertDialog(android.content.Context,int): use the holographic alert theme with a dark background.

static Int

Special theme constant for AlertDialog(android.content.Context,int): use the holographic alert theme with a light background.

static Int

Special theme constant for AlertDialog(android.content.Context,int): use the traditional (pre-Holo) alert dialog theme.

Inherited constants
Int BUTTON1

Int BUTTON2

Int BUTTON3

Int BUTTON_NEGATIVE

The identifier for the negative button.

Int BUTTON_NEUTRAL

The identifier for the neutral button.

Int BUTTON_POSITIVE

The identifier for the positive button.

Protected constructors
AlertDialog(context: Context!)

Creates an alert dialog that uses the default alert dialog theme.

AlertDialog(context: Context!, cancelable: Boolean, cancelListener: DialogInterface.OnCancelListener!)

Creates an alert dialog that uses the default alert dialog theme and a custom cancel listener.

AlertDialog(context: Context!, themeResId: Int)

Creates an alert dialog that uses an explicit theme resource.

Public methods
open Button!
getButton(whichButton: Int)

Gets one of the buttons used in the dialog.

open ListView!

Gets the list view used in the dialog.

open Boolean
onKeyDown(keyCode: Int, event: KeyEvent)

open Boolean
onKeyUp(keyCode: Int, event: KeyEvent)

open Unit
setButton(whichButton: Int, text: CharSequence!, listener: DialogInterface.OnClickListener!)

Set a listener to be invoked when the specified button of the dialog is pressed.

open Unit
setButton(whichButton: Int, text: CharSequence!, msg: Message!)

Set a message to be sent when a button is pressed.

open Unit

Set a listener to be invoked when button 1 of the dialog is pressed.

open Unit
setButton(text: CharSequence!, msg: Message!)

open Unit

Set a listener to be invoked when button 2 of the dialog is pressed.

open Unit

open Unit

Set a listener to be invoked when button 3 of the dialog is pressed.

open Unit

open Unit
setCustomTitle(customTitleView: View!)

open Unit
setIcon(icon: Drawable!)

open Unit
setIcon(resId: Int)

Set resId to 0 if you don't want an icon.

open Unit

Set an icon as supplied by a theme attribute.

open Unit
setInverseBackgroundForced(forceInverseBackground: Boolean)

open Unit

open Unit

open Unit
setView(view: View!)

Set the view to display in that dialog.

open Unit
setView(view: View!, viewSpacingLeft: Int, viewSpacingTop: Int, viewSpacingRight: Int, viewSpacingBottom: Int)

Set the view to display in that dialog, specifying the spacing to appear around that view.

Protected methods
open Unit
onCreate(savedInstanceState: Bundle!)

Inherited functions
Unit addContentView(view: View, params: ViewGroup.LayoutParams?)

Add an additional content view to the screen. Added after any existing ones in the screen -- existing views are NOT removed.

Unit cancel()

Cancel the dialog. This is essentially the same as calling dismiss(), but it will also call your DialogInterface.OnCancelListener (if registered).

Unit closeOptionsMenu()

Unit create()

Forces immediate creation of the dialog.

Note that you should not override this method to perform dialog creation. Rather, override onCreate(android.os.Bundle).

Unit dismiss()

Dismiss this dialog, removing it from the screen. This method can be invoked safely from any thread. Note that you should not override this method to do cleanup when the dialog is dismissed, instead implement that in onStop.

Boolean dispatchGenericMotionEvent(ev: MotionEvent)

Called to process generic motion events. You can override this to intercept all generic motion events before they are dispatched to the window. Be sure to call this implementation for generic motion events that should be handled normally.

Boolean dispatchKeyEvent(event: KeyEvent)

Called to process key events. You can override this to intercept all key events before they are dispatched to the window. Be sure to call this implementation for key events that should be handled normally.

Boolean dispatchKeyShortcutEvent(event: KeyEvent)

Called to process a key shortcut event. You can override this to intercept all key shortcut events before they are dispatched to the window. Be sure to call this implementation for key shortcut events that should be handled normally.

Boolean dispatchPopulateAccessibilityEvent(event: AccessibilityEvent)

Called to process population of AccessibilityEvents.

Boolean dispatchTouchEvent(ev: MotionEvent)

Called to process touch screen events. You can override this to intercept all touch screen events before they are dispatched to the window. Be sure to call this implementation for touch screen events that should be handled normally.

Boolean dispatchTrackballEvent(ev: MotionEvent)

Called to process trackball events. You can override this to intercept all trackball events before they are dispatched to the window. Be sure to call this implementation for trackball events that should be handled normally.

T findViewById(id: Int)

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()).

Note: In most cases -- depending on compiler support -- the resulting view is automatically cast to the target class type. If the target class type is unconstrained, an explicit cast may be necessary.

ActionBar? getActionBar()

Retrieve the ActionBar attached to this dialog, if present.

Context getContext()

Retrieve the Context this Dialog is running in.

View? getCurrentFocus()

Call android.view.Window#getCurrentFocus on the Window if this Activity to return the currently focused view.

LayoutInflater getLayoutInflater()

OnBackInvokedDispatcher getOnBackInvokedDispatcher()

Returns the OnBackInvokedDispatcher instance associated with the window that this dialog is attached to.

Activity? getOwnerActivity()

Returns the Activity that owns this Dialog. For example, if Activity.showDialog(int) is used to show this Dialog, that Activity will be the owner (by default). Depending on how this dialog was created, this may return null.

SearchEvent? getSearchEvent()

During the onSearchRequested() callbacks, this function will return the SearchEvent that triggered the callback, if it exists.

Int getVolumeControlStream()

Window? getWindow()

Retrieve the current Window for the activity. This can be used to directly access parts of the Window API that are not available through Activity/Screen.

Unit hide()

Hide the dialog, but do not dismiss it.

Unit invalidateOptionsMenu()

Boolean isShowing()

Unit onActionModeFinished(mode: ActionMode!)

Called when an action mode has been finished. The appropriate mode callback method will have already been invoked. Note that if you override this method you should always call through to the superclass implementation by calling super.onActionModeFinished(mode).
If you override this method you must call through to the superclass implementation.

Unit onActionModeStarted(mode: ActionMode!)

Called when an action mode has been started. The appropriate mode callback method will have already been invoked. Note that if you override this method you should always call through to the superclass implementation by calling super.onActionModeStarted(mode).
If you override this method you must call through to the superclass implementation.

Unit onAttachedToWindow()

Unit onBackPressed()

Called when the dialog has detected the user's press of the back key. The default implementation simply cancels the dialog (only if it is cancelable), but you can override this to do whatever you want.

If you target version android.os.Build.VERSION_CODES#TIRAMISU or later, you should not use this method but register an OnBackInvokedCallback on an OnBackInvokedDispatcher that you can retrieve using getOnBackInvokedDispatcher(). You should also set android:enableOnBackInvokedCallback="true" in the application manifest.

Alternatively, you can use androidx.activity.ComponentDialog#getOnBackPressedDispatcher() for backward compatibility.

Unit onContentChanged()

Boolean onContextItemSelected(item: MenuItem)

Unit onContextMenuClosed(menu: Menu)

Unit onCreateContextMenu(menu: ContextMenu!, v: View!, menuInfo: ContextMenu.ContextMenuInfo!)

Boolean onCreateOptionsMenu(menu: Menu)

It is usually safe to proxy this call to the owner activity's Activity.onCreateOptionsMenu(Menu) if the client desires the same menu for this Dialog.

Boolean onCreatePanelMenu(featureId: Int, menu: Menu)

View? onCreatePanelView(featureId: Int)

Unit onDetachedFromWindow()

Boolean onGenericMotionEvent(event: MotionEvent)

Called when a generic motion event was not handled by any of the views inside of the dialog.

Generic motion events describe joystick movements, mouse hovers, track pad touches, scroll wheel movements and other input events. The source of the motion event specifies the class of input that was received. Implementations of this method must examine the bits in the source before processing the event. The following code example shows how this is done.

Generic motion events with source class android.view.InputDevice#SOURCE_CLASS_POINTER are delivered to the view under the pointer. All other generic motion events are delivered to the focused view.

See View.onGenericMotionEvent(MotionEvent) for an example of how to handle this event.

Boolean onKeyLongPress(keyCode: Int, event: KeyEvent)

Default implementation of KeyEvent.Callback.onKeyLongPress(): always returns false (doesn't handle the event).

Boolean onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent)

Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event).

Boolean onKeyShortcut(keyCode: Int, event: KeyEvent)

Called when a key shortcut event is not handled by any of the views in the Dialog. Override this method to implement global key shortcuts for the Dialog. Key shortcuts can also be implemented by setting the shortcut property of menu items.

Boolean onMenuItemSelected(featureId: Int, item: MenuItem)

Boolean onMenuOpened(featureId: Int, menu: Menu)

Boolean onOptionsItemSelected(item: MenuItem)

Unit onOptionsMenuClosed(menu: Menu)

Unit onPanelClosed(featureId: Int, menu: Menu)

Boolean onPrepareOptionsMenu(menu: Menu)

It is usually safe to proxy this call to the owner activity's Activity.onPrepareOptionsMenu(Menu) if the client desires the same menu for this Dialog.

Boolean onPreparePanel(featureId: Int, view: View?, menu: Menu)

Unit onRestoreInstanceState(savedInstanceState: Bundle)

Restore the state of the dialog from a previously saved bundle. The default implementation restores the state of the dialog's view hierarchy that was saved in the default implementation of onSaveInstanceState(), so be sure to call through to super when overriding unless you want to do all restoring of state yourself.

Bundle onSaveInstanceState()

Saves the state of the dialog into a bundle. The default implementation saves the state of its view hierarchy, so you'll likely want to call through to super if you override this to save additional state.

Boolean onSearchRequested()

This hook is called when the user signals the desire to start a search.

Boolean onSearchRequested(searchEvent: SearchEvent)

This hook is called when the user signals the desire to start a search.

Unit onStart()

Called when the dialog is starting.

Unit onStop()

Called to tell you that you're stopping.

Boolean onTouchEvent(event: MotionEvent)

Called when a touch screen event was not handled by any of the views under it. This is most useful to process touch events that happen outside of your window bounds, where there is no view to receive it.

Boolean onTrackballEvent(event: MotionEvent)

Called when the trackball was moved and not handled by any of the views inside of the activity. So, for example, if the trackball moves while focus is on a button, you will receive a call here because buttons do not normally do anything with trackball events. The call here happens before trackball movements are converted to DPAD key events, which then get sent back to the view hierarchy, and will be processed at the point for things like focus navigation.

Unit onWindowAttributesChanged(params: WindowManager.LayoutParams!)

Unit onWindowFocusChanged(hasFocus: Boolean)

ActionMode? onWindowStartingActionMode(callback: ActionMode.Callback!)

ActionMode? onWindowStartingActionMode(callback: ActionMode.Callback!, type: Int)

Unit openContextMenu(view: View)

Unit openOptionsMenu()

Unit registerForContextMenu(view: View)

Boolean requestWindowFeature(featureId: Int)

Enable extended window features. This is a convenience for calling getWindow().requestFeature().

T requireViewById(id: Int)

Finds the first descendant view with the given ID or throws an IllegalArgumentException 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()).

Note: In most cases -- depending on compiler support -- the resulting view is automatically cast to the target class type. If the target class type is unconstrained, an explicit cast may be necessary.

Unit setCancelMessage(msg: Message?)

Set a message to be sent when the dialog is canceled.

Unit setCancelable(flag: Boolean)

Sets whether this dialog is cancelable with the BACK key.

Unit setCanceledOnTouchOutside(cancel: Boolean)

Sets whether this dialog is canceled when touched outside the window's bounds. If setting to true, the dialog is set to be cancelable if not already set.

Unit setContentView(view: View)

Set the screen content to an explicit view. This view is placed directly into the screen's view hierarchy. It can itself be a complex view hierarchy.

Unit setContentView(view: View, params: ViewGroup.LayoutParams?)

Set the screen content to an explicit view. This view is placed directly into the screen's view hierarchy. It can itself be a complex view hierarchy.

Unit setContentView(layoutResID: Int)

Set the screen content from a layout resource. The resource will be inflated, adding all top-level views to the screen.

Unit setDismissMessage(msg: Message?)

Set a message to be sent when the dialog is dismissed.

Unit setFeatureDrawable(featureId: Int, drawable: Drawable?)

Convenience for calling android.view.Window#setFeatureDrawable(int, Drawable).

Unit setFeatureDrawableAlpha(featureId: Int, alpha: Int)

Convenience for calling android.view.Window#setFeatureDrawableAlpha.

Unit setFeatureDrawableResource(featureId: Int, resId: Int)

Convenience for calling android.view.Window#setFeatureDrawableResource.

Unit setFeatureDrawableUri(featureId: Int, uri: Uri?)

Convenience for calling android.view.Window#setFeatureDrawableUri.

Unit setOnCancelListener(listener: DialogInterface.OnCancelListener?)

Set a listener to be invoked when the dialog is canceled.

This will only be invoked when the dialog is canceled. Cancel events alone will not capture all ways that the dialog might be dismissed. If the creator needs to know when a dialog is dismissed in general, use setOnDismissListener.

Unit setOnDismissListener(listener: DialogInterface.OnDismissListener?)

Set a listener to be invoked when the dialog is dismissed.

Unit setOnKeyListener(onKeyListener: DialogInterface.OnKeyListener?)

Sets the callback that will be called if a key is dispatched to the dialog.

Unit setOnShowListener(listener: DialogInterface.OnShowListener?)

Sets a listener to be invoked when the dialog is shown.

Unit setOwnerActivity(activity: Activity)

Sets the Activity that owns this dialog. An example use: This Dialog will use the suggested volume control stream of the Activity.

Unit setTitle(titleId: Int)

Set the title text for this dialog's window. The text is retrieved from the resources with the supplied identifier.

Unit setVolumeControlStream(streamType: Int)

By default, this will use the owner Activity's suggested stream type.

Unit show()

Start the dialog and display it on screen. The window is placed in the application layer and opaque. Note that you should not override this method to do initialization when the dialog is shown, instead implement that in onStart.

Unit takeKeyEvents(get: Boolean)

Request that key events come to this dialog. Use this if your dialog has no views with focus, but the dialog still wants a chance to process key events.

Unit unregisterForContextMenu(view: View)

Unit onPointerCaptureChanged(hasCapture: Boolean)

Called when pointer capture is enabled or disabled for the current window.

Unit onProvideKeyboardShortcuts(data: MutableList<KeyboardShortcutGroup!>!, menu: Menu?, deviceId: Int)

Called when Keyboard Shortcuts are requested for the current window.

Constants

THEME_DEVICE_DEFAULT_DARK

Added in API level 14
Deprecated in API level 23
static val THEME_DEVICE_DEFAULT_DARK: Int

Deprecated: Use android.R.style#Theme_DeviceDefault_Dialog_Alert.

Special theme constant for AlertDialog(android.content.Context,int): use the device's default alert theme with a dark background.

Value: 4

THEME_DEVICE_DEFAULT_LIGHT

Added in API level 14
Deprecated in API level 23
static val THEME_DEVICE_DEFAULT_LIGHT: Int

Deprecated: Use android.R.style#Theme_DeviceDefault_Light_Dialog_Alert.

Special theme constant for AlertDialog(android.content.Context,int): use the device's default alert theme with a light background.

Value: 5

THEME_HOLO_DARK

Added in API level 11
Deprecated in API level 23
static val THEME_HOLO_DARK: Int

Deprecated: Use android.R.style#Theme_Material_Dialog_Alert.

Special theme constant for AlertDialog(android.content.Context,int): use the holographic alert theme with a dark background.

Value: 2

THEME_HOLO_LIGHT

Added in API level 11
Deprecated in API level 23
static val THEME_HOLO_LIGHT: Int

Deprecated: Use android.R.style#Theme_Material_Light_Dialog_Alert.

Special theme constant for AlertDialog(android.content.Context,int): use the holographic alert theme with a light background.

Value: 3

THEME_TRADITIONAL

Added in API level 11
Deprecated in API level 23
static val THEME_TRADITIONAL: Int

Deprecated: Use android.R.style#Theme_Material_Dialog_Alert.

Special theme constant for AlertDialog(android.content.Context,int): use the traditional (pre-Holo) alert dialog theme.

Value: 1

Protected constructors

AlertDialog

Added in API level 1
protected AlertDialog(context: Context!)

Creates 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.

Parameters
context Context!: the parent context

AlertDialog

Added in API level 1
protected AlertDialog(
    context: Context!,
    cancelable: Boolean,
    cancelListener: DialogInterface.OnCancelListener!)

Creates an alert dialog that uses the default alert dialog theme and a custom cancel listener.

This is functionally identical to:

AlertDialog dialog = new AlertDialog(context);
      alertDialog.setCancelable(cancelable);
      alertDialog.setOnCancelListener(cancelListener);
  

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

Parameters
context Context!: the parent context

AlertDialog

Added in API level 1
protected AlertDialog(
    context: Context!,
    themeResId: Int)

Creates 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.

Parameters
context Context!: the parent context
themeResId Int: the resource ID of the theme against which to inflate this dialog, or 0 to use the parent context's default alert dialog theme

Public methods

getButton

Added in API level 3
open fun getButton(whichButton: Int): Button!

Gets one of the buttons used in the dialog. Returns null if the specified button does not exist or the dialog has not yet been fully created (for example, via show() or create()).

Parameters
whichButton Int: The identifier of the button that should be returned. For example, this can be DialogInterface.BUTTON_POSITIVE.
Return
Button! The button from the dialog, or null if a button does not exist.

getListView

Added in API level 3
open fun getListView(): ListView!

Gets the list view used in the dialog.

Return
ListView! The ListView from the dialog.

onKeyDown

Added in API level 1
open fun onKeyDown(
    keyCode: Int,
    event: KeyEvent
): Boolean
Parameters
keyCode Int: The value in event.getKeyCode().
event KeyEvent: This value cannot be null.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyUp

Added in API level 1
open fun onKeyUp(
    keyCode: Int,
    event: KeyEvent
): Boolean
Parameters
keyCode Int: The value in event.getKeyCode().
event KeyEvent: This value cannot be null.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

setButton

Added in API level 3
open fun setButton(
    whichButton: Int,
    text: CharSequence!,
    listener: DialogInterface.OnClickListener!
): Unit

Set a listener to be invoked when the specified button of the dialog is pressed.

Parameters
whichButton Int: Which button to set the listener on, can be one of DialogInterface.BUTTON_POSITIVE, DialogInterface.BUTTON_NEGATIVE, or DialogInterface.BUTTON_NEUTRAL
text CharSequence!: The text to display in positive button.
listener DialogInterface.OnClickListener!: The DialogInterface.OnClickListener to use.

setButton

Added in API level 3
open fun setButton(
    whichButton: Int,
    text: CharSequence!,
    msg: Message!
): Unit

Set a message to be sent when a button is pressed.

Parameters
whichButton Int: Which button to set the message for, can be one of DialogInterface.BUTTON_POSITIVE, DialogInterface.BUTTON_NEGATIVE, or DialogInterface.BUTTON_NEUTRAL
text CharSequence!: The text to display in positive button.
msg Message!: The Message to be sent when clicked.

setButton

Added in API level 1
Deprecated in API level 15
open fun setButton(
    text: CharSequence!,
    listener: DialogInterface.OnClickListener!
): Unit

Deprecated: Use setButton(int,java.lang.CharSequence,android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_POSITIVE

Set a listener to be invoked when button 1 of the dialog is pressed.

Parameters
text CharSequence!: The text to display in button 1.
listener DialogInterface.OnClickListener!: The DialogInterface.OnClickListener to use.

setButton

Added in API level 1
Deprecated in API level 15
open fun setButton(
    text: CharSequence!,
    msg: Message!
): Unit

Deprecated: Use setButton(int,java.lang.CharSequence,android.os.Message) with DialogInterface.BUTTON_POSITIVE.

setButton2

Added in API level 1
Deprecated in API level 15
open fun setButton2(
    text: CharSequence!,
    listener: DialogInterface.OnClickListener!
): Unit

Deprecated: Use setButton(int,java.lang.CharSequence,android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_NEGATIVE

Set a listener to be invoked when button 2 of the dialog is pressed.

Parameters
text CharSequence!: The text to display in button 2.
listener DialogInterface.OnClickListener!: The DialogInterface.OnClickListener to use.

setButton2

Added in API level 1
Deprecated in API level 15
open fun setButton2(
    text: CharSequence!,
    msg: Message!
): Unit

Deprecated: Use setButton(int,java.lang.CharSequence,android.os.Message) with DialogInterface.BUTTON_NEGATIVE.

setButton3

Added in API level 1
Deprecated in API level 15
open fun setButton3(
    text: CharSequence!,
    listener: DialogInterface.OnClickListener!
): Unit

Deprecated: Use setButton(int,java.lang.CharSequence,android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_NEUTRAL

Set a listener to be invoked when button 3 of the dialog is pressed.

Parameters
text CharSequence!: The text to display in button 3.
listener DialogInterface.OnClickListener!: The DialogInterface.OnClickListener to use.

setButton3

Added in API level 1
Deprecated in API level 15
open fun setButton3(
    text: CharSequence!,
    msg: Message!
): Unit

Deprecated: Use setButton(int,java.lang.CharSequence,android.os.Message) with DialogInterface.BUTTON_NEUTRAL.

setCustomTitle

Added in API level 1
open fun setCustomTitle(customTitleView: View!): Unit

setIcon

Added in API level 1
open fun setIcon(icon: Drawable!): Unit

setIcon

Added in API level 1
open fun setIcon(resId: Int): Unit

Set resId to 0 if you don't want an icon.

Parameters
resId Int: the resourceId of the drawable to use as the icon or 0 if you don't want an icon.

setIconAttribute

Added in API level 11
open fun setIconAttribute(attrId: Int): Unit

Set an icon as supplied by a theme attribute. e.g. android.R.attr.alertDialogIcon

Parameters
attrId Int: ID of a theme attribute that points to a drawable resource.

setInverseBackgroundForced

Added in API level 1
open fun setInverseBackgroundForced(forceInverseBackground: Boolean): Unit

setMessage

Added in API level 1
open fun setMessage(message: CharSequence!): Unit

setTitle

Added in API level 1
open fun setTitle(title: CharSequence?): Unit
Parameters
title CharSequence?: The new text to display in the title. This value may be null.

setView

Added in API level 1
open fun setView(view: View!): Unit

Set the view to display in that dialog.

setView

Added in API level 3
open fun setView(
    view: View!,
    viewSpacingLeft: Int,
    viewSpacingTop: Int,
    viewSpacingRight: Int,
    viewSpacingBottom: Int
): Unit

Set the view to display in that dialog, specifying the spacing to appear around that view.

Parameters
view View!: The view to show in the content area of the dialog
viewSpacingLeft Int: Extra space to appear to the left of view
viewSpacingTop Int: Extra space to appear above view
viewSpacingRight Int: Extra space to appear to the right of view
viewSpacingBottom Int: Extra space to appear below view

Protected methods

onCreate

Added in API level 1
protected open fun onCreate(savedInstanceState: Bundle!): Unit
Parameters
savedInstanceState Bundle!: If this dialog is being reinitialized after a the hosting activity was previously shut down, holds the result from the most recent call to onSaveInstanceState, or null if this is the first time.