AppCompatDialog


public class AppCompatDialog extends ComponentDialog implements 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(@NonNull Context context, int theme)

Protected constructors

AppCompatDialog(
    @NonNull Context context,
    boolean cancelable,
    @Nullable DialogInterface.OnCancelListener cancelListener
)

Public methods

void
void
boolean
@Nullable T
<T extends View> findViewById(@IdRes int id)
@NonNull AppCompatDelegate
ActionBar

Support library version of getActionBar.

void

Called when a support action mode has finished.

void

Called when a support action mode has been started.

@Nullable ActionMode

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

void
setContentView(@LayoutRes int layoutResID)
void
void
void
void
setTitle(int titleId)
boolean

Enable extended support library window features.

Protected methods

void
onCreate(Bundle savedInstanceState)
void

Inherited Constants

From android.content.DialogInterface
static final int
BUTTON1 = -1

This field is deprecated.

static final int
BUTTON2 = -2

This field is deprecated.

static final int
BUTTON3 = -3

This field is deprecated.

static final int
static final int
static final int

Inherited methods

From androidx.activity.ComponentDialog
Lifecycle
NavigationEventDispatcher

Lazily provides a NavigationEventDispatcher for back navigation handling, including support for predictive back gestures introduced in Android 13 (API 33+).

final OnBackPressedDispatcher

Retrieve the OnBackPressedDispatcher that will be triggered when onBackPressed is called.

SavedStateRegistry
void

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

void

This method is deprecated.

Bundle
void
From android.app.Dialog
void
void
void
void
boolean
boolean
boolean
boolean
boolean
ActionBar
final Context
View
LayoutInflater
OnBackInvokedDispatcher
final Activity
final SearchEvent
final int
Window
void
boolean
void
void
void
void

This method is deprecated.

void
boolean
void
void
onCreate(Bundle savedInstanceState)
void
onCreateContextMenu(
    ContextMenu menu,
    View v,
    ContextMenu.ContextMenuInfo menuInfo
)
boolean
boolean
onCreatePanelMenu(int featureId, Menu menu)
View
onCreatePanelView(int featureId)
void
boolean
boolean
onKeyDown(int keyCode, KeyEvent event)
boolean
onKeyLongPress(int keyCode, KeyEvent event)
boolean
onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
boolean
onKeyShortcut(int keyCode, KeyEvent event)
boolean
onKeyUp(int keyCode, KeyEvent event)
boolean
onMenuItemSelected(int featureId, MenuItem item)
boolean
onMenuOpened(int featureId, Menu menu)
boolean
void
void
onPanelClosed(int featureId, Menu menu)
boolean
boolean
onPreparePanel(int featureId, View view, Menu menu)
void
onRestoreInstanceState(Bundle savedInstanceState)
Bundle
boolean
void
void
boolean
boolean
void
void
onWindowFocusChanged(boolean hasFocus)
ActionMode
void
void
void
final boolean
requestWindowFeature(int featureId)
final T
<T extends View> requireViewById(int id)
void
void
setCancelable(boolean flag)
void
setCanceledOnTouchOutside(boolean cancel)
void
void
final void
setFeatureDrawable(int featureId, Drawable drawable)
final void
setFeatureDrawableAlpha(int featureId, int alpha)
final void
setFeatureDrawableResource(int featureId, int resId)
final void
setFeatureDrawableUri(int featureId, Uri uri)
void
void
void
void
final void
final void
setVolumeControlStream(int streamType)
void
void
takeKeyEvents(boolean get)
void
From androidx.lifecycle.LifecycleOwner
abstract Lifecycle
From androidx.navigationevent.NavigationEventDispatcherOwner
From androidx.savedstate.SavedStateRegistryOwner
From android.view.Window.Callback
void
onPointerCaptureChanged(boolean hasCapture)
void
onProvideKeyboardShortcuts(
    List<KeyboardShortcutGroup> data,
    Menu menu,
    int deviceId
)

Public constructors

AppCompatDialog

Added in 1.1.0
public AppCompatDialog(@NonNull Context context)

AppCompatDialog

Added in 1.1.0
public AppCompatDialog(@NonNull Context context, int theme)

Protected constructors

AppCompatDialog

Added in 1.1.0
protected AppCompatDialog(
    @NonNull Context context,
    boolean cancelable,
    @Nullable DialogInterface.OnCancelListener cancelListener
)

Public methods

addContentView

public void addContentView(@NonNull View view, ViewGroup.LayoutParams params)

dismiss

public void dismiss()

dispatchKeyEvent

public boolean dispatchKeyEvent(KeyEvent event)

findViewById

public @Nullable T <T extends View> findViewById(@IdRes int id)

getDelegate

Added in