# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Inherited Constants | Ctors | Protected Ctors | Methods | Protected Methods | Inherited Methods

# Dialog

`public class Dialog`
`extends Object` `implements DialogInterface, Window.Callback, KeyEvent.Callback, View.OnCreateContextMenuListener`

java.lang.Object
↳ | android.app.Dialog

Known direct subclasses AlertDialog, CharacterPickerDialog, Presentation
AlertDialog | A subclass of Dialog that can display one, two or three buttons.
CharacterPickerDialog | Dialog for choosing accented characters related to a base character.
Presentation | Base class for presentations.

Known indirect subclasses DatePickerDialog, ProgressDialog, TimePickerDialog
DatePickerDialog | A simple dialog containing an `DatePicker`.
ProgressDialog | This class is deprecated. `ProgressDialog` is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like `ProgressBar`, which can be embedded in your app's UI. Alternatively, you can use a notification to inform the user of the task's progress.
TimePickerDialog | A dialog that prompts the user for the time of day using a `TimePicker`.

Base class for Dialogs.

Note: Activities provide a facility to manage the creation, saving and restoring of dialogs. See `Activity#onCreateDialog(int)`, `Activity#onPrepareDialog(int, Dialog)`, `Activity#showDialog(int)`, and `Activity#dismissDialog(int)`. If these methods are used, `getOwnerActivity()` will return the Activity that managed this dialog.

Often you will want to have a Dialog display on top of the current input method, because there is no reason for it to accept text. You can do this by setting the `WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM` window flag (assuming your Dialog takes input focus, as it the default) with the following code:

     getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
             WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

### Developer Guides

For more information about creating dialogs, read the Dialogs developer guide.

## Summary

### Inherited constants
From interface `android.content.DialogInterface`
`int` | `BUTTON1` This constant is deprecated. Use `BUTTON_POSITIVE`
`int` | `BUTTON2` This constant is deprecated. Use `BUTTON_NEGATIVE`
`int` | `BUTTON3` This constant is deprecated. Use `BUTTON_NEUTRAL`
`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.

### Public constructors
`Dialog(Context context)` Creates a dialog window that uses the default dialog theme.
`Dialog(Context context, int themeResId)` Creates a dialog window that uses a custom dialog style.

### Protected constructors
`Dialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener)`

### Public methods
`void` | `addContentView(View view, ViewGroup.LayoutParams params)` Add an additional content view to the screen.
`void` | `cancel()` Cancel the dialog.
`void` | `closeOptionsMenu()`
`void` | `create()` Forces immediate creation of the dialog.
`void` | `dismiss()` Dismiss this dialog, removing it from the screen.
`boolean` | `dispatchGenericMotionEvent(MotionEvent ev)` Called to process generic motion events.
`boolean` | `dispatchKeyEvent(KeyEvent event)` Called to process key events.
`boolean` | `dispatchKeyShortcutEvent(KeyEvent event)` Called to process a key shortcut event.
`boolean` | `dispatchPopulateAccessibilityEvent(AccessibilityEvent event)` Called to process population of `AccessibilityEvent`s.
`boolean` | `dispatchTouchEvent(MotionEvent ev)` Called to process touch screen events.
`boolean` | `dispatchTrackballEvent(MotionEvent ev)` Called to process trackball events.
`<T extends View> T` | `findViewById(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()`).
`ActionBar` | `getActionBar()` Retrieve the `ActionBar` attached to this dialog, if present.
`final Context` | `getContext()` Retrieve the Context this Dialog is running in.
`View` | `getCurrentFocus()` Call `Window.getCurrentFocus()` on the Window if this Activity to return the currently focused view.
`LayoutInflater` | `getLayoutInflater()`
`final Activity` | `getOwnerActivity()` Returns the Activity that owns this Dialog.
`final SearchEvent` | `getSearchEvent()` During the onSearchRequested() callbacks, this function will return the `SearchEvent` that triggered the callback, if it exists.
`final int` | `getVolumeControlStream()`
`Window` | `getWindow()` Retrieve the current Window for the activity.
`void` | `hide()` Hide the dialog, but do not dismiss it.
`void` | `invalidateOptionsMenu()`
`boolean` | `isShowing()`
`void` | `onActionModeFinished(ActionMode mode)` Called when an action mode has been finished. Note that if you override this method you should always call through to the superclass implementation by calling super.onActionModeFinished(mode).
`void` | `onActionModeStarted(ActionMode mode)` Called when an action mode has been started. Note that if you override this method you should always call through to the superclass implementation by calling super.onActionModeStarted(mode).
`void` | `onAttachedToWindow()` Called when the window has been attached to the window manager.
`void` | `onBackPressed()` Called when the dialog has detected the user's press of the back key.
`void` | `onContentChanged()` This hook is called whenever the content view of the screen changes (due to a call to `Window#setContentView(View, android.view.ViewGroup.LayoutParams)` or `Window#addContentView(View, android.view.ViewGroup.LayoutParams)`).
`boolean` | `onContextItemSelected(MenuItem item)`
`void` | `onContextMenuClosed(Menu menu)`
`void` | `onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)` Called when the context menu for this view is being built.
`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(int featureId, Menu menu)` Initialize the contents of the menu for panel 'featureId'.
`View` | `onCreatePanelView(int featureId)` Instantiate the view to display in the panel for 'featureId'.
`void` | `onDetachedFromWindow()` Called when the window has been detached from the window manager.
`boolean` | `onGenericMotionEvent(MotionEvent event)` Called when a generic motion event was not handled by any of the views inside of the dialog.
`boolean` | `onKeyDown(int keyCode, KeyEvent event)` A key was pressed down.
`boolean` | `onKeyLongPress(int keyCode, KeyEvent event)` Default implementation of `KeyEvent.Callback#onKeyLongPress(int, KeyEvent)`: always returns false (doesn't handle the event).
`boolean` | `onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)` Default implementation of `KeyEvent.Callback#onKeyMultiple(int, int, KeyEvent)`: always returns false (doesn't handle the event).
`boolean` | `onKeyShortcut(int keyCode, KeyEvent event)` Called when a key shortcut event is not handled by any of the views in the Dialog.
`boolean` | `onKeyUp(int keyCode, KeyEvent event)` A key was released.
`boolean` | `onMenuItemSelected(int featureId, MenuItem item)` Called when a panel's menu item has been selected by the user.
`boolean` | `onMenuOpened(int featureId, Menu menu)` Called when a panel's menu is opened by the user.
`boolean` | `onOptionsItemSelected(MenuItem item)`
`void` | `onOptionsMenuClosed(Menu menu)`
`void` | `onPanelClosed(int featureId, Menu menu)` Called when a panel is being closed.
`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(int featureId, View view, Menu menu)` Prepare a panel to be displayed.
`void` | `onRestoreInstanceState(Bundle savedInstanceState)` Restore the state of the dialog from a previously saved bundle.
`Bundle` | `onSaveInstanceState()` Saves the state of the dialog into a bundle.
`boolean` | `onSearchRequested(SearchEvent searchEvent)` This hook is called when the user signals the desire to start a search.
`boolean` | `onSearchRequested()` This hook is called when the user signals the desire to start a search.
`boolean` | `onTouchEvent(MotionEvent event)` Called when a touch screen event was not handled by any of the views under it.
`boolean` | `onTrackballEvent(MotionEvent event)` Called when the trackball was moved and not handled by any of the views inside of the activity.
`void` | `onWindowAttributesChanged(WindowManager.LayoutParams params)` This is called whenever the current window attributes change.
`void` | `onWindowFocusChanged(boolean hasFocus)` This hook is called whenever the window focus changes.
`ActionMode` | `onWindowStartingActionMode(ActionMode.Callback callback)` Called when an action mode is being started for this window.
`ActionMode` | `onWindowStartingActionMode(ActionMode.Callback callback, int type)` Called when an action mode is being started for this window.
`void` | `openContextMenu(View view)`
`void` | `openOptionsMenu()`
`void` | `registerForContextMenu(View view)`
`final boolean` | `requestWindowFeature(int featureId)` Enable extended window features.
`final <T extends View> T` | `requireViewById(int id)` 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()`).
`void` | `setCancelMessage(Message msg)` Set a message to be sent when the dialog is canceled.
`void` | `setCancelable(boolean flag)` Sets whether this dialog is cancelable with the `KeyEvent#KEYCODE_BACK` key.
`void` | `setCanceledOnTouchOutside(boolean cancel)` Sets whether this dialog is canceled when touched outside the window's bounds.
`void` | `setContentView(int layoutResID)` Set the screen content from a layout resource.
`void` | `setContentView(View view, ViewGroup.LayoutParams params)` Set the screen content to an explicit view.
`void` | `setContentView(View view)` Set the screen content to an explicit view.
`void` | `setDismissMessage(Message msg)` Set a message to be sent when the dialog is dismissed.
`final void` | `setFeatureDrawable(int featureId, Drawable drawable)` Convenience for calling `Window.setFeatureDrawable(int, Drawable)`.
`final void` | `setFeatureDrawableAlpha(int featureId, int alpha)` Convenience for calling `Window.setFeatureDrawableAlpha(int, int)`.
`final void` | `setFeatureDrawableResource(int featureId, int resId)` Convenience for calling `Window.setFeatureDrawableResource(int, int)`.
`final void` | `setFeatureDrawableUri(int featureId, Uri uri)` Convenience for calling `Window.setFeatureDrawableUri(int, Uri)`.
`void` | `setOnCancelListener(DialogInterface.OnCancelListener listener)` Set a listener to be invoked when the dialog is canceled.
`void` | `setOnDismissListener(DialogInterface.OnDismissListener listener)` Set a listener to be invoked when the dialog is dismissed.
`void` | `setOnKeyListener(DialogInterface.OnKeyListener onKeyListener)` Sets the callback that will be called if a key is dispatched to the dialog.
`void` | `setOnShowListener(DialogInterface.OnShowListener listener)` Sets a listener to be invoked when the dialog is shown.
`final void` | `setOwnerActivity(Activity activity)` Sets the Activity that owns this dialog.
`void` | `setTitle(CharSequence title)` Set the title text for this dialog's window.
`void` | `setTitle(int titleId)` Set the title text for this dialog's window.
`final void` | `setVolumeControlStream(int streamType)` By default, this will use the owner Activity's suggested stream type.
`void` | `show()` Start the dialog and display it on screen.
`void` | `takeKeyEvents(boolean get)` Request that key events come to this dialog.
`void` | `unregisterForContextMenu(View view)`

### Protected methods
`void` | `onCreate(Bundle savedInstanceState)` Similar to `Activity#onCreate`, you should initialize your dialog in this method, including calling `setContentView(View)`.
`void` | `onStart()` Called when the dialog is starting.
`void` | `onStop()` Called to tell you that you're stopping.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.content.DialogInterface`
`abstract void` | `cancel()` Cancels the dialog, invoking the `OnCancelListener`.
`abstract void` | `dismiss()` Dismisses the dialog, invoking the `OnDismissListener`.
From interface `android.view.Window.Callback`
`abstract boolean` | `dispatchGenericMotionEvent(MotionEvent event)` Called to process generic motion events.
`abstract boolean` | `dispatchKeyEvent(KeyEvent event)` Called to process key events.
`abstract boolean` | `dispatchKeyShortcutEvent(KeyEvent event)` Called to process a key shortcut event.
`abstract boolean` | `dispatchPopulateAccessibilityEvent(AccessibilityEvent event)` Called to process population of `AccessibilityEvent`s.
`abstract boolean` | `dispatchTouchEvent(MotionEvent event)` Called to process touch screen events.
`abstract boolean` | `dispatchTrackballEvent(MotionEvent event)` Called to process trackball events.
`abstract void` | `onActionModeFinished(ActionMode mode)` Called when an action mode has been finished.
`abstract void` | `onActionModeStarted(ActionMode mode)` Called when an action mode has been started.
`abstract void` | `onAttachedToWindow()` Called when the window has been attached to the window manager.
`abstract void` | `onContentChanged()` This hook is called whenever the content view of the screen changes (due to a call to `Window#setContentView(View, android.view.ViewGroup.LayoutParams)` or `Window#addContentView(View, android.view.ViewGroup.LayoutParams)`).
`abstract boolean` | `onCreatePanelMenu(int featureId, Menu menu)` Initialize the contents of the menu for panel 'featureId'.
`abstract View` | `onCreatePanelView(int featureId)` Instantiate the view to display in the panel for 'featureId'.
`abstract void` | `onDetachedFromWindow()` Called when the window has been detached from the window manager.
`abstract boolean` | `onMenuItemSelected(int featureId, MenuItem item)` Called when a panel's menu item has been selected by the user.
`abstract boolean` | `onMenuOpened(int featureId, Menu menu)` Called when a panel's menu is opened by the user.
`abstract void` | `onPanelClosed(int featureId, Menu menu)` Called when a panel is being closed.
`default void` | `onPointerCaptureChanged(boolean hasCapture)` Called when pointer capture is enabled or disabled for the current window.
`abstract boolean` | `onPreparePanel(int featureId, View view, Menu menu)` Prepare a panel to be displayed.
`default void` | `onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data, Menu menu, int deviceId)` Called when Keyboard Shortcuts are requested for the current window.
`abstract boolean` | `onSearchRequested()` Called when the user signals the desire to start a search.
`abstract boolean` | `onSearchRequested(SearchEvent searchEvent)` Called when the user signals the desire to start a search.
`abstract void` | `onWindowAttributesChanged(WindowManager.LayoutParams attrs)` This is called whenever the current window attributes change.
`abstract void` | `onWindowFocusChanged(boolean hasFocus)` This hook is called whenever the window focus changes.
`abstract ActionMode` | `onWindowStartingActionMode(ActionMode.Callback callback)` Called when an action mode is being started for this window.
`abstract ActionMode` | `onWindowStartingActionMode(ActionMode.Callback callback, int type)` Called when an action mode is being started for this window.
From interface `android.view.KeyEvent.Callback`
`abstract boolean` | `onKeyDown(int keyCode, KeyEvent event)` Called when a key down event has occurred.
`abstract boolean` | `onKeyLongPress(int keyCode, KeyEvent event)` Called when a long press has occurred.
`abstract boolean` | `onKeyMultiple(int keyCode, int count, KeyEvent event)` Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.
`abstract boolean` | `onKeyUp(int keyCode, KeyEvent event)` Called when a key up event has occurred.
From interface `android.view.View.OnCreateContextMenuListener`
`abstract void` | `onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)` Called when the context menu for this view is being built.

## Public constructors

### Dialog

    public Dialog (Context context)

Creates a dialog window that uses the default dialog theme.

The supplied `context` is used to obtain the window manager and base theme used to present the dialog.

Parameters
`context` | `Context`: the context in which the dialog should run This value cannot be `null`.

See also:

- `R.styleable.Theme_dialogTheme`

### Dialog

    public Dialog (Context context,
                    int themeResId)

Creates a dialog window that uses a custom dialog style.

The supplied `context` is used to obtain the window manager and base theme used to present the dialog.

The supplied `theme` is applied on top of the context's theme. See Style and Theme Resources for more information about defining and using styles.

Parameters
`context` | `Context`: the context in which the dialog should run This value cannot be `null`.
`themeResId` | `int`: a style resource describing the theme to use for the window, or `0` to use the default dialog theme

## Protected constructors

### Dialog

    protected Dialog (Context context,
                    boolean cancelable,
                    DialogInterface.OnCancelListener cancelListener)

Parameters
`context` | `Context`: This value cannot be `null`.
`cancelable` | `boolean`
`cancelListener` | `DialogInterface.OnCancelListener`: This value may be `null`.

## Public methods

### addContentView

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

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

Parameters
`view` | `View`: The desired content to display. This value cannot be `null`.
`params` | `ViewGroup.LayoutParams`: Layout parameters for the view. This value may be `null`.

### cancel

    public void cancel ()

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

### closeOptionsMenu

    public void closeOptionsMenu ()

See also:

- `Activity.closeOptionsMenu()`

### create

    public void 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)`.

### dismiss

    public void 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()`.

### dispatchGenericMotionEvent

    public boolean dispatchGenericMotionEvent (MotionEvent ev)

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.

Parameters
`ev` | `MotionEvent`: The generic motion event. This value cannot be `null`.

Returns
`boolean` | boolean Return true if this event was consumed.

### dispatchKeyEvent

    public boolean dispatchKeyEvent (KeyEvent event)

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.

Parameters
`event` | `KeyEvent`: The key event. This value cannot be `null`.

Returns
`boolean` | boolean Return true if this event was consumed.

### dispatchKeyShortcutEvent

    public boolean dispatchKeyShortcutEvent (KeyEvent event)

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.

Parameters
`event` | `KeyEvent`: The key shortcut event. This value cannot be `null`.

Returns
`boolean` | True if this event was consumed.

### dispatchPopulateAccessibilityEvent

    public boolean dispatchPopulateAccessibilityEvent (AccessibilityEvent event)

Called to process population of `AccessibilityEvent`s.

Parameters
`event` | `AccessibilityEvent`: This value cannot be `null`.

Returns
`boolean` | boolean Return true if event population was completed.

### dispatchTouchEvent

    public boolean dispatchTouchEvent (MotionEvent ev)

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.

Parameters
`ev` | `MotionEvent`: The touch screen event. This value cannot be `null`.

Returns
`boolean` | boolean Return true if this event was consumed.

### dispatchTrackballEvent

    public boolean dispatchTrackballEvent (MotionEvent ev)

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.

Parameters
`ev` | `MotionEvent`: The trackball event. This value cannot be `null`.

Returns
`boolean` | boolean Return true if this event was consumed.

### findViewById

    public T findViewById (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()`).

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.

Parameters
`id` | `int`: the ID to search for

Returns
`T` | a view with given ID if found, or `null` otherwise

See also:

- `View.findViewById(int)`
- `requireViewById(int)`

### getActionBar

    public ActionBar getActionBar ()

Retrieve the `ActionBar` attached to this dialog, if present.

Returns
`ActionBar` | The ActionBar attached to the dialog or null if no ActionBar is present.

### getContext

    public final Context getContext ()

Retrieve the Context this Dialog is running in.

Returns
`Context` | Context The Context used by the Dialog. This value cannot be `null`.

### getCurrentFocus

    public View getCurrentFocus ()

Call `Window.getCurrentFocus()` on the Window if this Activity to return the currently focused view.

Returns
`View` | View The current View with focus or null.

See also:

- `getWindow()`
- `Window.getCurrentFocus()`

### getLayoutInflater

    public LayoutInflater getLayoutInflater ()

Returns
`LayoutInflater` | This value cannot be `null`.

### getOwnerActivity

    public final 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.

Returns
`Activity` | The Activity that owns this Dialog.

### getSearchEvent

    public final SearchEvent getSearchEvent ()

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

Returns
`SearchEvent` | SearchEvent The SearchEvent that triggered the `onSearchRequested()` callback. This value may be `null`.

### getVolumeControlStream

    public final int getVolumeControlStream ()

Returns
`int` |

See also:

- `Activity.getVolumeControlStream()`

### getWindow

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

Returns
`Window` | Window The current window, or null if the activity is not visual.

### hide

    public void hide ()

Hide the dialog, but do not dismiss it.

### invalidateOptionsMenu

    public void invalidateOptionsMenu ()

See also:

- `Activity.invalidateOptionsMenu()`

### isShowing

    public boolean isShowing ()

Returns
`boolean` | Whether the dialog is currently showing.

### onActionModeFinished

    public void onActionModeFinished (ActionMode mode)

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.

Parameters
`mode` | `ActionMode`: The mode that was just finished.

### onActionModeStarted

    public void onActionModeStarted (ActionMode mode)

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.

Parameters
`mode` | `ActionMode`: The new mode that has just been started.

### onAttachedToWindow

    public void onAttachedToWindow ()

Called when the window has been attached to the window manager. See `View#onAttachedToWindow()` for more information.

### onBackPressed

    public void 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.

### onContentChanged

    public void onContentChanged ()

This hook is called whenever the content view of the screen changes (due to a call to `Window#setContentView(View, android.view.ViewGroup.LayoutParams)` or `Window#addContentView(View, android.view.ViewGroup.LayoutParams)`).

### onContextItemSelected

    public boolean onContextItemSelected (MenuItem item)

Parameters
`item` | `MenuItem`: This value cannot be `null`.

Returns
`boolean` |

See also:

- `Activity.onContextItemSelected(MenuItem)`

### onContextMenuClosed

    public void onContextMenuClosed (Menu menu)

Parameters
`menu` | `Menu`: This value cannot be `null`.

See also:

- `Activity.onContextMenuClosed(Menu)`

### onCreateContextMenu

    public void onCreateContextMenu (ContextMenu menu,
                    View v,
                    ContextMenu.ContextMenuInfo menuInfo)

Called when the context menu for this view is being built. It is not safe to hold onto the menu after this method returns.

Parameters
`menu` | `ContextMenu`: The context menu that is being built
`v` | `View`: The view for which the context menu is being built
`menuInfo` | `ContextMenu.ContextMenuInfo`: Extra information about the item for which the context menu should be shown. This information will vary depending on the class of v.

See also:

- `Activity.onCreateContextMenu(ContextMenu, View, ContextMenuInfo)`

### onCreateOptionsMenu

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

Parameters
`menu` | `Menu`: This value cannot be `null`.

Returns
`boolean` |

See also:

- `Activity.onCreateOptionsMenu(Menu)`
- `getOwnerActivity()`

### onCreatePanelMenu

    public boolean onCreatePanelMenu (int featureId,
                    Menu menu)

Initialize the contents of the menu for panel 'featureId'. This is called if onCreatePanelView() returns null, giving you a standard menu in which you can place your items. It is only called once for the panel, the first time it is shown.

You can safely hold on to menu (and any items created from it), making modifications to it as desired, until the next time onCreatePanelMenu() is called for this feature.

Parameters
`featureId` | `int`: The panel being created.
`menu` | `Menu`: This value cannot be `null`.

Returns
`boolean` | boolean You must return true for the panel to be displayed; if you return false it will not be shown.

See also:

- `Activity.onCreatePanelMenu(int, Menu)`

### onCreatePanelView

    public View onCreatePanelView (int featureId)

Instantiate the view to display in the panel for 'featureId'. You can return null, in which case the default content (typically a menu) will be created for you.

Parameters
`featureId` | `int`: Which panel is being created.

Returns
`View` | view The top-level view to place in the panel.

See also:

- `Activity.onCreatePanelView(int)`

### onDetachedFromWindow

    public void onDetachedFromWindow ()

Called when the window has been detached from the window manager. See `View#onDetachedFromWindow()` for more information.

### onGenericMotionEvent

    public boolean onGenericMotionEvent (MotionEvent event)

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 `MotionEvent#getSource()` 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 `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.

Parameters
`event` | `MotionEvent`: The generic motion event being processed. This value cannot be `null`.

Returns
`boolean` | Return true if you have consumed the event, false if you haven't. The default implementation always returns false.

### onKeyDown

    public boolean onKeyDown (int keyCode,
                    KeyEvent event)

A key was pressed down.

If the focused view didn't want this event, this method is called.

Default implementation consumes `KeyEvent#KEYCODE_BACK` and, as of `P`, `KeyEvent#KEYCODE_ESCAPE` to later handle them in `onKeyUp(int, KeyEvent)`.

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`event` | `KeyEvent`: This value cannot be `null`.

Returns
`boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

See also:

- `onKeyUp(int, KeyEvent)`
- `KeyEvent`

### onKeyLongPress

    public boolean onKeyLongPress (int keyCode,
                    KeyEvent event)

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

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`event` | `KeyEvent`: This value cannot be `null`.

Returns
`boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

### onKeyMultiple

    public boolean onKeyMultiple (int keyCode,
                    int repeatCount,
                    KeyEvent event)

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

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`repeatCount` | `int`: Number of pairs as returned by event.getRepeatCount().
`event` | `KeyEvent`: This value cannot be `null`.

Returns
`boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

### onKeyShortcut

    public boolean onKeyShortcut (int keyCode,
                    KeyEvent event)

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 `MenuItem#setShortcut(char, char)` property of menu items.

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`event` | `KeyEvent`: Description of the key event. This value cannot be `null`.

Returns
`boolean` | True if the key shortcut was handled.

### onKeyUp

    public boolean onKeyUp (int keyCode,
                    KeyEvent event)

A key was released.

Default implementation consumes `KeyEvent#KEYCODE_BACK` and, as of `P`, `KeyEvent#KEYCODE_ESCAPE` to close the dialog.

Parameters
`keyCode` | `int`: The value in event.getKeyCode().
`event` | `KeyEvent`: This value cannot be `null`.

Returns
`boolean` | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

See also:

- `onKeyDown(int, KeyEvent)`
- `KeyEvent`

### onMenuItemSelected

    public boolean onMenuItemSelected (int featureId,
                    MenuItem item)

Called when a panel's menu item has been selected by the user.

Parameters
`featureId` | `int`: The panel that the menu is in.
`item` | `MenuItem`: This value cannot be `null`.

Returns
`boolean` | boolean Return true to finish processing of selection, or false to perform the normal menu handling (calling its Runnable or sending a Message to its target Handler).

See also:

- `Activity.onMenuItemSelected(int, MenuItem)`

### onMenuOpened

    public boolean onMenuOpened (int featureId,
                    Menu menu)

Called when a panel's menu is opened by the user. This may also be called when the menu is changing from one type to another (for example, from the icon menu to the expanded menu).

Parameters
`featureId` | `int`: The panel that the menu is in.
`menu` | `Menu`: This value cannot be `null`.

Returns
`boolean` | Return true to allow the menu to open, or false to prevent the menu from opening.

See also:

- `Activity.onMenuOpened(int, Menu)`

### onOptionsItemSelected

    public boolean onOptionsItemSelected (MenuItem item)

Parameters
`item` | `MenuItem`: This value cannot be `null`.

Returns
`boolean` |

See also:

- `Activity.onOptionsItemSelected(MenuItem)`

### onOptionsMenuClosed

    public void onOptionsMenuClosed (Menu menu)

Parameters
`menu` | `Menu`: This value cannot be `null`.

See also:

- `Activity.onOptionsMenuClosed(Menu)`

### onPanelClosed

    public void onPanelClosed (int featureId,
                    Menu menu)

Called when a panel is being closed. If another logical subsequent panel is being opened (and this panel is being closed to make room for the subsequent panel), this method will NOT be called.

Parameters
`featureId` | `int`: The panel that is being displayed.
`menu` | `Menu`: This value cannot be `null`.

See also:

- `Activity.onPanelClosed(int, Menu)`

### onPrepareOptionsMenu

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

Parameters
`menu` | `Menu`: This value cannot be `null`.

Returns
`boolean` |

See also:

- `Activity.onPrepareOptionsMenu(Menu)`
- `getOwnerActivity()`

### onPreparePanel

    public boolean onPreparePanel (int featureId,
                    View view,
                    Menu menu)

Prepare a panel to be displayed. This is called right before the panel window is shown, every time it is shown.

Parameters
`featureId` | `int`: The panel that is being displayed.
`view` | `View`: This value may be `null`.
`menu` | `Menu`: This value cannot be `null`.

Returns
`boolean` | boolean You must return true for the panel to be displayed; if you return false it will not be shown.

See also:

- `Activity.onPreparePanel(int, View, Menu)`

### onRestoreInstanceState

    public void onRestoreInstanceState (Bundle savedInstanceState)

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.

Parameters
`savedInstanceState` | `Bundle`: The state of the dialog previously saved by `onSaveInstanceState()`. This value cannot be `null`.

### onSaveInstanceState

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

Returns
`Bundle` | A bundle with the state of the dialog. This value cannot be `null`.

### onSearchRequested

    public boolean onSearchRequested (SearchEvent searchEvent)

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

Parameters
`searchEvent` | `SearchEvent`: This value cannot be `null`.

Returns
`boolean` | true if search launched, false if activity refuses (blocks)

### onSearchRequested

    public boolean onSearchRequested ()

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

Returns
`boolean` | true if search launched, false if activity refuses (blocks)

### onTouchEvent

    public boolean onTouchEvent (MotionEvent event)

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.

Parameters
`event` | `MotionEvent`: The touch screen event being processed. This value cannot be `null`.

Returns
`boolean` | Return true if you have consumed the event, false if you haven't. The default implementation will cancel the dialog when a touch happens outside of the window bounds.

### onTrackballEvent

    public boolean onTrackballEvent (MotionEvent event)

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.

Parameters
`event` | `MotionEvent`: The trackball event being processed. This value cannot be `null`.

Returns
`boolean` | Return true if you have consumed the event, false if you haven't. The default implementation always returns false.

### onWindowAttributesChanged

    public void onWindowAttributesChanged (WindowManager.LayoutParams params)

This is called whenever the current window attributes change.

Parameters
`params` | `WindowManager.LayoutParams`

### onWindowFocusChanged

    public void onWindowFocusChanged (boolean hasFocus)

This hook is called whenever the window focus changes. See `View#onWindowFocusChanged(boolean)` for more information.

Parameters
`hasFocus` | `boolean`: Whether the window now has focus.

### onWindowStartingActionMode

    public ActionMode onWindowStartingActionMode (ActionMode.Callback callback)

Called when an 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. This is equivalent to `onWindowStartingActionMode(android.view.ActionMode.Callback, int)` with type `ActionMode#TYPE_PRIMARY`.

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

### onWindowStartingActionMode

    public ActionMode onWindowStartingActionMode (ActionMode.Callback callback,
                    int type)

Called when an 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
`type` | `int`: One of `ActionMode#TYPE_PRIMARY` or `ActionMode#TYPE_FLOATING`.

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

### openContextMenu

    public void openContextMenu (View view)

Parameters
`view` | `View`: This value cannot be `null`.

See also:

- `Activity.openContextMenu(View)`

### openOptionsMenu

    public void openOptionsMenu ()

See also:

- `Activity.openOptionsMenu()`

### registerForContextMenu

    public void registerForContextMenu (View view)

Parameters
`view` | `View`: This value cannot be `null`.

See also:

- `Activity.registerForContextMenu(View)`

### requestWindowFeature

    public final boolean requestWindowFeature (int featureId)

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

Parameters
`featureId` | `int`: The desired feature as defined in `Window`.

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

See also:

- `Window.requestFeature(int)`

### requireViewById

    public final T requireViewById (int id)

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.

Parameters
`id` | `int`: the ID to search for

Returns
`T` | a view with given ID This value cannot be `null`.

See also:

- `View.requireViewById(int)`
- `findViewById(int)`

### setCancelMessage

    public void setCancelMessage (Message msg)

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

Parameters
`msg` | `Message`: The msg to send when the dialog is canceled. This value may be `null`.

See also:

- `setOnCancelListener(android.content.DialogInterface.OnCancelListener)`

### setCancelable

    public void setCancelable (boolean flag)

Sets whether this dialog is cancelable with the `KeyEvent#KEYCODE_BACK` key.

Parameters
`flag` | `boolean`

### setCanceledOnTouchOutside

    public void setCanceledOnTouchOutside (boolean cancel)

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.

Parameters
`cancel` | `boolean`: Whether the dialog should be canceled when touched outside the window.

### setContentView

    public void setContentView (int layoutResID)

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

Parameters
`layoutResID` | `int`: Resource ID to be inflated.

### setContentView

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

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.

Parameters
`view` | `View`: The desired content to display. This value cannot be `null`.
`params` | `ViewGroup.LayoutParams`: Layout parameters for the view. This value may be `null`.

### setContentView

    public void 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.

Parameters
`view` | `View`: The desired content to display. This value cannot be `null`.

### setDismissMessage

    public void setDismissMessage (Message msg)

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

Parameters
`msg` | `Message`: The msg to send when the dialog is dismissed. This value may be `null`.

### setFeatureDrawable

    public final void setFeatureDrawable (int featureId,
                    Drawable drawable)

Convenience for calling `Window.setFeatureDrawable(int, Drawable)`.

Parameters
`featureId` | `int`
`drawable` | `Drawable`: This value may be `null`.

### setFeatureDrawableAlpha

    public final void setFeatureDrawableAlpha (int featureId,
                    int alpha)

Convenience for calling `Window.setFeatureDrawableAlpha(int, int)`.

Parameters
`featureId` | `int`
`alpha` | `int`

### setFeatureDrawableResource

    public final void setFeatureDrawableResource (int featureId,
                    int resId)

Convenience for calling `Window.setFeatureDrawableResource(int, int)`.

Parameters
`featureId` | `int`
`resId` | `int`

### setFeatureDrawableUri

    public final void setFeatureDrawableUri (int featureId,
                    Uri uri)

Convenience for calling `Window.setFeatureDrawableUri(int, Uri)`.

Parameters
`featureId` | `int`
`uri` | `Uri`: This value may be `null`.

### setOnCancelListener

    public void setOnCancelListener (DialogInterface.OnCancelListener listener)

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(DialogInterface.OnDismissListener)`.

Parameters
`listener` | `DialogInterface.OnCancelListener`: The `DialogInterface.OnCancelListener` to use. This value may be `null`.

### setOnDismissListener

    public void setOnDismissListener (DialogInterface.OnDismissListener listener)

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

Parameters
`listener` | `DialogInterface.OnDismissListener`: The `DialogInterface.OnDismissListener` to use. This value may be `null`.

### setOnKeyListener

    public void setOnKeyListener (DialogInterface.OnKeyListener onKeyListener)

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

Parameters
`onKeyListener` | `DialogInterface.OnKeyListener`: This value may be `null`.

### setOnShowListener

    public void setOnShowListener (DialogInterface.OnShowListener listener)

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

Parameters
`listener` | `DialogInterface.OnShowListener`: The `DialogInterface.OnShowListener` to use. This value may be `null`.

### setOwnerActivity

    public final void 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.

Parameters
`activity` | `Activity`: The Activity that owns this dialog. This value cannot be `null`.

### setTitle

    public void setTitle (CharSequence title)

Set the title text for this dialog's window.

Parameters
`title` | `CharSequence`: The new text to display in the title. This value may be `null`.

### setTitle

    public void setTitle (int titleId)

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

Parameters
`titleId` | `int`: the title's text resource identifier

### setVolumeControlStream

    public final void setVolumeControlStream (int streamType)

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

Parameters
`streamType` | `int`

See also:

- `Activity.setVolumeControlStream(int)`
- `setOwnerActivity(Activity)`

### show

    public void 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()`.

### takeKeyEvents

    public void takeKeyEvents (boolean get)

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.

Parameters
`get` | `boolean`: true if the dialog should receive key events, false otherwise

See also:

- `Window.takeKeyEvents(boolean)`

### unregisterForContextMenu

    public void unregisterForContextMenu (View view)

Parameters
`view` | `View`: This value cannot be `null`.

See also:

- `Activity.unregisterForContextMenu(View)`

## Protected methods

### onCreate

    protected void onCreate (Bundle savedInstanceState)

Similar to `Activity#onCreate`, you should initialize your dialog in this method, including calling `setContentView(View)`.

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.

### onStart

    protected void onStart ()

Called when the dialog is starting.

### onStop

    protected void onStop ()

Called to tell you that you're stopping.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*