AppCompatDialog

class AppCompatDialog : ComponentDialog, AppCompatCallback

Known direct subclasses
AlertDialog

A subclass of Dialog that can display one, two or three buttons.

MediaRouteChooserDialog

This class implements the route chooser dialog for MediaRouter.

Known indirect subclasses
MediaRouteControllerDialog

This class implements the route controller dialog for MediaRouter.


Base class for AppCompat themed android.app.Dialogs.

Summary

Public constructors

AppCompatDialog(context: Context, theme: Int)

Protected constructors

AppCompatDialog(
    context: Context,
    cancelable: Boolean,
    cancelListener: DialogInterface.OnCancelListener?
)

Public functions

Unit
Unit
Boolean
T?
<T : View?> findViewById(id: @IdRes Int)
AppCompatDelegate
ActionBar!

Support library version of getActionBar.

Unit

Called when a support action mode has finished.

Unit

Called when a support action mode has been started.

ActionMode?

Called when a support action mode is being started for this window.

Unit
setContentView(layoutResID: @LayoutRes Int)
Unit
Unit
Unit
Unit
setTitle(titleId: Int)
Boolean

Enable extended support library window features.

Protected functions

Unit
onCreate(savedInstanceState: Bundle!)
Unit

Inherited Constants

From android.content.DialogInterface
const Int
BUTTON1 = -1

This property is deprecated.

const Int
BUTTON2 = -2

This property is deprecated.

const Int
BUTTON3 = -3

This property is deprecated.

const Int
const Int
const Int

Inherited functions

From androidx.activity.ComponentDialog
Lifecycle!

Returns the Lifecycle of the provider.

SavedStateRegistry!

The SavedStateRegistry owned by this SavedStateRegistryOwner

Unit

Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present.

Unit

This function is deprecated.

Bundle!
Unit
From android.app.Dialog
Unit
Unit
Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
ActionBar!
Context!
View!
LayoutInflater!
OnBackInvokedDispatcher!
Activity!
SearchEvent!
Int
Window!
Unit
Boolean
Unit
Unit
Unit
Unit

This function is deprecated.

Unit
Boolean
Unit
Unit
onCreate(savedInstanceState: Bundle!)
Unit
onCreateContextMenu(
    menu: ContextMenu!,
    v: View!,
    menuInfo: ContextMenu.ContextMenuInfo!
)
Boolean
Boolean
onCreatePanelMenu(featureId: Int, menu: Menu!)
View!
onCreatePanelView(featureId: Int)
Unit
Boolean
Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)
Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent!)
Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent!)
Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent!)
Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)
Boolean
onMenuItemSelected(featureId: Int, item: MenuItem!)
Boolean
onMenuOpened(featureId: Int, menu: Menu!)
Boolean
Unit
Unit
onPanelClosed(featureId: Int, menu: Menu!)
Boolean
Boolean
onPreparePanel(featureId: Int, view: View!, menu: Menu!)
Unit
onRestoreInstanceState(savedInstanceState: Bundle!)
Bundle!
Boolean
Unit
Unit
Boolean
Boolean
Unit
Unit
ActionMode!
Unit
Unit
Unit
Boolean
T!
<T : View?> requireViewById(id: Int)
Unit
Unit
Unit
Unit
setContentView(layoutResID: Int)
Unit
Unit
setFeatureDrawable(featureId: Int, drawable: Drawable!)
Unit
setFeatureDrawableAlpha(featureId: Int, alpha: Int)
Unit
setFeatureDrawableResource(featureId: Int, resId: Int)
Unit
setFeatureDrawableUri(featureId: Int, uri: Uri!)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
From android.view.Window.Callback
Unit
Unit
onProvideKeyboardShortcuts(
    data: (Mutable)List<KeyboardShortcutGroup!>!,
    menu: Menu!,
    deviceId: Int
)

Inherited properties

From androidx.activity.ComponentDialog
OnBackPressedDispatcher!

The OnBackPressedDispatcher that should handle the system back button.

Public constructors

AppCompatDialog

Added in 1.1.0
AppCompatDialog(context: Context)

AppCompatDialog

Added in 1.1.0
AppCompatDialog(context: Context, theme: Int)

Protected constructors

AppCompatDialog

Added in 1.1.0
protected AppCompatDialog(
    context: Context,
    cancelable: Boolean,
    cancelListener: DialogInterface.OnCancelListener?
)

Public functions

addContentView

fun addContentView(view: View, params: ViewGroup.LayoutParams!): Unit

dismiss

fun dismiss(): Unit

dispatchKeyEvent

fun dispatchKeyEvent(event: KeyEvent!): Boolean

findViewById

fun <T : View?> findViewById(id: @IdRes Int): T?

getDelegate

Added in 1.1.0
fun getDelegate(): AppCompatDelegate
Returns
AppCompatDelegate

The AppCompatDelegate being used by this Dialog.

getSupportActionBar

Added in 1.1.0
fun getSupportActionBar(): ActionBar!

Support library version of getActionBar.

Retrieve a reference to this dialog's ActionBar.

Returns
ActionBar!

The Dialog's ActionBar, or null if it does not have one.

onSupportActionModeFinished

Added in 1.7.0-alpha03
fun onSupportActionModeFinished(mode: ActionMode!): Unit

Called when a support action mode has finished.

Parameters
mode: ActionMode!

The action mode that just finished.

onSupportActionModeStarted

Added in 1.7.0-alpha03
fun onSupportActionModeStarted(mode: ActionMode!): Unit

Called when a support action mode has been started.

Parameters
mode: ActionMode!

The new action mode.

onWindowStartingSupportActionMode

Added in 1.7.0-alpha03
fun onWindowStartingSupportActionMode(callback: ActionMode.Callback!): ActionMode?

Called when a support action mode is being started for this window. Gives the callback an opportunity to handle the action mode in its own unique and beautiful way. If this method returns null the system can choose a way to present the mode or choose not to start the mode at all.

Parameters
callback: ActionMode.Callback!

Callback to control the lifecycle of this action mode

Returns
ActionMode?

The ActionMode that was started, or null if the system should present it

setContentView

fun setContentView(layoutResID: @LayoutRes Int): Unit

setContentView

fun setContentView(view: View): Unit

setContentView

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

setTitle

fun setTitle(title: CharSequence!): Unit

setTitle

fun setTitle(titleId: Int): Unit

supportRequestWindowFeature

Added in 1.1.0
fun supportRequestWindowFeature(featureId: Int): Boolean

Enable extended support library window features.

This is a convenience for calling getWindow().requestFeature().

Parameters
featureId: Int

The desired feature as defined in android.view.Window or androidx.core.view.WindowCompat.

Returns
Boolean

Returns true if the requested feature is supported and now enabled.

Protected functions

onCreate

protected fun onCreate(savedInstanceState: Bundle!): Unit

onStop

protected fun onStop(): Unit