# ComponentDialog

Artifact: [androidx.activity:activity](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/ComponentDialog.kt+class:androidx.activity.ComponentDialog) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/activity#1.5.0)

*** ** * ** ***

<br />

```
public class ComponentDialog extends Dialog implements LifecycleOwner, OnBackPressedDispatcherOwner, NavigationEventDispatcherOwner, SavedStateRegistryOwner
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [android.app.Dialog](https://developer.android.com/reference/android/app/Dialog.html) ||
|   | ↳ | [androidx.activity.ComponentDialog](https://developer.android.com/reference/androidx/activity/ComponentDialog) |

Known direct subclasses [AppCompatDialog](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialog)

|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialog` | Base class for AppCompat themed `https://developer.android.com/reference/android/app/Dialog.html`s. |

Known indirect subclasses [AlertDialog](https://developer.android.com/reference/androidx/appcompat/app/AlertDialog), [MediaRouteChooserDialog](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialog), [MediaRouteControllerDialog](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialog)

|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/AlertDialog` | A subclass of Dialog that can display one, two or three buttons. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialog` | This class implements the route chooser dialog for `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter`. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialog` | This class implements the route controller dialog for `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter`. |

*** ** * ** ***

Base class for dialogs that enables composition of higher level components.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/activity/ComponentDialog#ComponentDialog(android.content.Context,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/StyleRes int themeResId)` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#addContentView(android.view.View,android.view.ViewGroup.LayoutParams)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view, https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html params)` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#getLifecycle()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigationevent/NavigationEventDispatcher` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#getNavigationEventDispatcher()()` Lazily provides a `https://developer.android.com/reference/androidx/navigationevent/NavigationEventDispatcher` for back navigation handling, including support for predictive back gestures introduced in Android 13 (API 33+). |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#getOnBackPressedDispatcher()()` Retrieve the `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` that will be triggered when `https://developer.android.com/reference/androidx/activity/ComponentDialog#onBackPressed()` is called. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/savedstate/SavedStateRegistry` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#getSavedStateRegistry()()` |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/activity/ComponentDialog#initializeViewTreeOwners()()` Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper [onBackPressed](https://developer.android.com/reference/androidx/activity/ComponentDialog#onBackPressed())()` **This method is deprecated.** This method has been deprecated in favor of using the {@link OnBackPressedDispatcher} via {@link #getOnBackPressedDispatcher()}. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#onSaveInstanceState()()` |
| `void` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#setContentView(kotlin.Int)(int layoutResID)` |
| `void` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#setContentView(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view)` |
| `void` | `https://developer.android.com/reference/androidx/activity/ComponentDialog#setContentView(android.view.View,android.view.ViewGroup.LayoutParams)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view, https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html params)` |

| ### Protected methods |
|---|---|
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/activity/ComponentDialog#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html savedInstanceState)` |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/activity/ComponentDialog#onStart()()` |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/activity/ComponentDialog#onStop()()` |

### Inherited methods

From [android.app.Dialog](https://developer.android.com/reference/android/app/Dialog.html) `void` `https://developer.android.com/reference/android/app/Dialog.html#cancel()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#closeOptionsMenu()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#create()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#dismiss()()` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#dispatchGenericMotionEvent(android.view.MotionEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MotionEvent.html ev)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#dispatchKeyEvent(android.view.KeyEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#dispatchKeyShortcutEvent(android.view.KeyEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#dispatchTouchEvent(android.view.MotionEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MotionEvent.html ev)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#dispatchTrackballEvent(android.view.MotionEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MotionEvent.html ev)` `@https://developer.android.com/reference/androidx/annotation/NonNull T` `<T extends https://developer.android.com/reference/android/view/View.html> https://developer.android.com/reference/android/app/Dialog.html#findViewById(int)(int id)` `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/ActionBar.html` `https://developer.android.com/reference/android/app/Dialog.html#getActionBar()()` `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/app/Dialog.html#getContext()()` `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/View.html` `https://developer.android.com/reference/android/app/Dialog.html#getCurrentFocus()()` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/LayoutInflater.html` `https://developer.android.com/reference/android/app/Dialog.html#getLayoutInflater()()` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/window/OnBackInvokedDispatcher.html` `https://developer.android.com/reference/android/app/Dialog.html#getOnBackInvokedDispatcher()()` `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/app/Activity.html` `https://developer.android.com/reference/android/app/Dialog.html#getOwnerActivity()()` `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SearchEvent.html` `https://developer.android.com/reference/android/app/Dialog.html#getSearchEvent()()` `final int` `https://developer.android.com/reference/android/app/Dialog.html#getVolumeControlStream()()` `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Window.html` `https://developer.android.com/reference/android/app/Dialog.html#getWindow()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#hide()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#invalidateOptionsMenu()()` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#isShowing()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#onActionModeFinished(android.view.ActionMode)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ActionMode.html mode)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onActionModeStarted(android.view.ActionMode)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ActionMode.html mode)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onAttachedToWindow()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#onContentChanged()()` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onContextItemSelected(android.view.MenuItem)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MenuItem.html item)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onContextMenuClosed(android.view.Menu)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)(

@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ContextMenu.html menu,

@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html v,

@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html menuInfo

)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onCreateOptionsMenu(android.view.Menu)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onCreatePanelMenu(int, android.view.Menu)(int featureId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `https://developer.android.com/reference/android/view/View.html` `https://developer.android.com/reference/android/app/Dialog.html#onCreatePanelView(int)(int featureId)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onDetachedFromWindow()()` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onGenericMotionEvent(android.view.MotionEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MotionEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onKeyDown(int, android.view.KeyEvent)(int keyCode, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onKeyLongPress(int, android.view.KeyEvent)(int keyCode, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onKeyMultiple(int, int, android.view.KeyEvent)(int keyCode, int repeatCount, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onKeyShortcut(int, android.view.KeyEvent)(int keyCode, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onKeyUp(int, android.view.KeyEvent)(int keyCode, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onMenuItemSelected(int, android.view.MenuItem)(int featureId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MenuItem.html item)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onMenuOpened(int, android.view.Menu)(int featureId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onOptionsItemSelected(android.view.MenuItem)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MenuItem.html item)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onOptionsMenuClosed(android.view.Menu)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onPanelClosed(int, android.view.Menu)(int featureId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onPrepareOptionsMenu(android.view.Menu)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onPreparePanel(int, android.view.View, android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/View.html view, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/Menu.html menu)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onRestoreInstanceState(android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html savedInstanceState)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onSearchRequested()()` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onSearchRequested(android.view.SearchEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/SearchEvent.html searchEvent)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onTouchEvent(android.view.MotionEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MotionEvent.html event)` `boolean` `https://developer.android.com/reference/android/app/Dialog.html#onTrackballEvent(android.view.MotionEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/MotionEvent.html event)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onWindowAttributesChanged(android.view.WindowManager.LayoutParams)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html params)` `void` `https://developer.android.com/reference/android/app/Dialog.html#onWindowFocusChanged(boolean)(boolean hasFocus)` `https://developer.android.com/reference/android/view/ActionMode.html` `https://developer.android.com/reference/android/app/Dialog.html#onWindowStartingActionMode(android.view.ActionMode.Callback)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ActionMode.Callback.html callback)` `https://developer.android.com/reference/android/view/ActionMode.html` `https://developer.android.com/reference/android/app/Dialog.html#onWindowStartingActionMode(android.view.ActionMode.Callback, int)(

@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ActionMode.Callback.html callback,

int type

)` `void` `https://developer.android.com/reference/android/app/Dialog.html#openContextMenu(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view)` `void` `https://developer.android.com/reference/android/app/Dialog.html#openOptionsMenu()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#registerForContextMenu(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view)` `final boolean` `https://developer.android.com/reference/android/app/Dialog.html#requestWindowFeature(int)(int featureId)` `final @https://developer.android.com/reference/androidx/annotation/NonNull T` `<T extends https://developer.android.com/reference/android/view/View.html> https://developer.android.com/reference/android/app/Dialog.html#requireViewById(int)(int id)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setCancelMessage(android.os.Message)(https://developer.android.com/reference/android/os/Message.html msg)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setCancelable(boolean)(boolean flag)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setCanceledOnTouchOutside(boolean)(boolean cancel)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setDismissMessage(android.os.Message)(https://developer.android.com/reference/android/os/Message.html msg)` `final void` `https://developer.android.com/reference/android/app/Dialog.html#setFeatureDrawable(int, android.graphics.drawable.Drawable)(int featureId, https://developer.android.com/reference/android/graphics/drawable/Drawable.html drawable)` `final void` `https://developer.android.com/reference/android/app/Dialog.html#setFeatureDrawableAlpha(int, int)(int featureId, int alpha)` `final void` `https://developer.android.com/reference/android/app/Dialog.html#setFeatureDrawableResource(int, int)(int featureId, int resId)` `final void` `https://developer.android.com/reference/android/app/Dialog.html#setFeatureDrawableUri(int, android.net.Uri)(int featureId, https://developer.android.com/reference/android/net/Uri.html uri)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setOnCancelListener(android.content.DialogInterface.OnCancelListener)(https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener.html listener)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setOnDismissListener(android.content.DialogInterface.OnDismissListener)(https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener.html listener)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setOnKeyListener(android.content.DialogInterface.OnKeyListener)(https://developer.android.com/reference/android/content/DialogInterface.OnKeyListener.html onKeyListener)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setOnShowListener(android.content.DialogInterface.OnShowListener)(https://developer.android.com/reference/android/content/DialogInterface.OnShowListener.html listener)` `final void` `https://developer.android.com/reference/android/app/Dialog.html#setOwnerActivity(android.app.Activity)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setTitle(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html title)` `void` `https://developer.android.com/reference/android/app/Dialog.html#setTitle(int)(int titleId)` `final void` `https://developer.android.com/reference/android/app/Dialog.html#setVolumeControlStream(int)(int streamType)` `void` `https://developer.android.com/reference/android/app/Dialog.html#show()()` `void` `https://developer.android.com/reference/android/app/Dialog.html#takeKeyEvents(boolean)(boolean get)` `void` `https://developer.android.com/reference/android/app/Dialog.html#unregisterForContextMenu(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view)` From [android.view.Window.Callback](https://developer.android.com/reference/android/view/Window.Callback.html) `void` `https://developer.android.com/reference/android/view/Window.Callback.html#onPointerCaptureChanged(boolean)(boolean hasCapture)` `void` `https://developer.android.com/reference/android/view/Window.Callback.html#onProvideKeyboardShortcuts(java.util.List&lt;android.view.KeyboardShortcutGroup&gt;, android.view.Menu, int)(

@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/KeyboardShortcutGroup.html> data,

https://developer.android.com/reference/android/view/Menu.html menu,

int deviceId

)`

## Public constructors

### ComponentDialog

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/activity#1.5.0)

```
public ComponentDialog(@NonNull Context context, @StyleRes int themeResId)
```

## Public methods

### addContentView

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

### getLifecycle

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/activity#1.5.0)

```
public @NonNull Lifecycle getLifecycle()
```

### getNavigationEventDispatcher

Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/activity#1.12.0)

```
public @NonNull NavigationEventDispatcher getNavigationEventDispatcher()
```

Lazily provides a `https://developer.android.com/reference/androidx/navigationevent/NavigationEventDispatcher` for back navigation handling, including support for predictive back gestures introduced in Android 13 (API 33+).

This dispatcher acts as the central point for back navigation events. When a navigation event occurs (e.g., a back gesture), it safely invokes `https://developer.android.com/reference/androidx/activity/ComponentDialog#onBackPressed()`.

### getOnBackPressedDispatcher

```
public final @NonNull OnBackPressedDispatcher getOnBackPressedDispatcher()
```

Retrieve the `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` that will be triggered when `https://developer.android.com/reference/androidx/activity/ComponentDialog#onBackPressed()` is called.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` | The `https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher` associated with this ComponentDialog. |

### getSavedStateRegistry

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/activity#1.7.0)

```
public @NonNull SavedStateRegistry getSavedStateRegistry()
```

### initializeViewTreeOwners

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/activity#1.8.0)

```
@CallSuper
public void initializeViewTreeOwners()
```

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

### onBackPressed

Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/activity#1.6.0)

```
@CallSuper
public void [onBackPressed](https://developer.android.com/reference/androidx/activity/ComponentDialog#onBackPressed())()
```

> [!CAUTION]
> **This method is deprecated.**   
> This method has been deprecated in favor of using the {@link OnBackPressedDispatcher} via {@link #getOnBackPressedDispatcher()}. The OnBackPressedDispatcher controls how back button events are dispatched to one or more {@link OnBackPressedCallback} objects.

### onSaveInstanceState

```
public @NonNull Bundle onSaveInstanceState()
```

### setContentView

```
public void setContentView(int layoutResID)
```

### setContentView

```
public void setContentView(@NonNull View view)
```

### setContentView

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

## Protected methods

### onCreate

```
@CallSuper
protected void onCreate(Bundle savedInstanceState)
```

### onStart

```
@CallSuper
protected void onStart()
```

### onStop

```
@CallSuper
protected void onStop()
```