Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/app/ProgressDialog#constants) \| [Inherited Constants](https://developer.android.com/reference/android/app/ProgressDialog#inhconstants) \| [Ctors](https://developer.android.com/reference/android/app/ProgressDialog#pubctors) \| [Methods](https://developer.android.com/reference/android/app/ProgressDialog#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/app/ProgressDialog#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/ProgressDialog#inhmethods)

# ProgressDialog

*** ** * ** ***

` public class ProgressDialog `   
` ` ` ` ` extends https://developer.android.com/reference/android/app/AlertDialog ` ` `

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||
| ↳ | [android.app.Dialog](https://developer.android.com/reference/android/app/Dialog) |||
|   | ↳ | [android.app.AlertDialog](https://developer.android.com/reference/android/app/AlertDialog) ||
|   |   | ↳ | android.app.ProgressDialog |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 26.**   
`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 `https://developer.android.com/reference/android/widget/ProgressBar`, which can be embedded in your app's UI. Alternatively, you can use a [notification](https://developer.android.com/guide/topics/ui/notifiers/notifications) to inform the user of the task's progress.

A dialog showing a progress indicator and an optional text message or view. Only a text message or a view can be used at the same time.

The dialog can be made cancelable on back key press.

The progress range is 0 to `https://developer.android.com/reference/android/app/ProgressDialog#getMax()`.

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_HORIZONTAL` Creates a ProgressDialog with a horizontal progress bar. |
| `int` | `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_SPINNER` Creates a ProgressDialog with a circular, spinning progress bar. |

### Inherited constants

From class `https://developer.android.com/reference/android/app/AlertDialog` `int` `https://developer.android.com/reference/android/app/AlertDialog#THEME_DEVICE_DEFAULT_DARK`

*This constant was deprecated in API level 23. Use `https://developer.android.com/reference/android/R.style#Theme_DeviceDefault_Dialog_Alert`.*
`int` `https://developer.android.com/reference/android/app/AlertDialog#THEME_DEVICE_DEFAULT_LIGHT`

*This constant was deprecated in API level 23. Use `https://developer.android.com/reference/android/R.style#Theme_DeviceDefault_Light_Dialog_Alert`.*
`int` `https://developer.android.com/reference/android/app/AlertDialog#THEME_HOLO_DARK`

*This constant was deprecated in API level 23. Use `https://developer.android.com/reference/android/R.style#Theme_Material_Dialog_Alert`.*
`int` `https://developer.android.com/reference/android/app/AlertDialog#THEME_HOLO_LIGHT`

*This constant was deprecated in API level 23. Use `https://developer.android.com/reference/android/R.style#Theme_Material_Light_Dialog_Alert`.*
`int` `https://developer.android.com/reference/android/app/AlertDialog#THEME_TRADITIONAL`

*This constant was deprecated in API level 23. Use `https://developer.android.com/reference/android/R.style#Theme_Material_Dialog_Alert`.*
From interface `https://developer.android.com/reference/android/content/DialogInterface` `int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON1`

*This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_POSITIVE`*
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON2`

*This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEGATIVE`*
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON3`

*This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEUTRAL`*
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEGATIVE`

The identifier for the negative button.
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEUTRAL`

The identifier for the neutral button.
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_POSITIVE`

The identifier for the positive button.

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/ProgressDialog#ProgressDialog(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Creates a Progress dialog. |
| ` https://developer.android.com/reference/android/app/ProgressDialog#ProgressDialog(android.content.Context,%20int)(https://developer.android.com/reference/android/content/Context context, int theme) ` Creates a Progress dialog. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/app/ProgressDialog#getMax()() ` Gets the maximum allowed progress value. |
| ` int` | ` https://developer.android.com/reference/android/app/ProgressDialog#getProgress()() ` Gets the current progress. |
| ` int` | ` https://developer.android.com/reference/android/app/ProgressDialog#getSecondaryProgress()() ` Gets the current secondary progress. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#incrementProgressBy(int)(int diff) ` Increments the current progress value. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#incrementSecondaryProgressBy(int)(int diff) ` Increments the current secondary progress value. |
| ` boolean` | ` https://developer.android.com/reference/android/app/ProgressDialog#isIndeterminate()() ` Whether this ProgressDialog is in indeterminate mode. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#onStart()() ` Called when the dialog is starting. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setIndeterminate(boolean)(boolean indeterminate) ` Change the indeterminate mode for this ProgressDialog. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setIndeterminateDrawable(android.graphics.drawable.Drawable)(https://developer.android.com/reference/android/graphics/drawable/Drawable d) ` Sets the drawable to be used to display the indeterminate progress value. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setMax(int)(int max) ` Sets the maximum allowed progress value. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setMessage(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence message) ` <br /> |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setProgress(int)(int value) ` Sets the current progress. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setProgressDrawable(android.graphics.drawable.Drawable)(https://developer.android.com/reference/android/graphics/drawable/Drawable d) ` Sets the drawable to be used to display the progress value. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setProgressNumberFormat(java.lang.String)(https://developer.android.com/reference/java/lang/String format) ` Change the format of the small text showing current and maximum units of progress. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setProgressPercentFormat(java.text.NumberFormat)(https://developer.android.com/reference/java/text/NumberFormat format) ` Change the format of the small text showing the percentage of progress. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setProgressStyle(int)(int style) ` Sets the style of this ProgressDialog, either `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_SPINNER` or `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_HORIZONTAL`. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#setSecondaryProgress(int)(int secondaryProgress) ` Sets the secondary progress. |
| ` static https://developer.android.com/reference/android/app/ProgressDialog` | ` https://developer.android.com/reference/android/app/ProgressDialog#show(android.content.Context,%20java.lang.CharSequence,%20java.lang.CharSequence)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/CharSequence title, https://developer.android.com/reference/java/lang/CharSequence message) ` Creates and shows a ProgressDialog. |
| ` static https://developer.android.com/reference/android/app/ProgressDialog` | ` https://developer.android.com/reference/android/app/ProgressDialog#show(android.content.Context,%20java.lang.CharSequence,%20java.lang.CharSequence,%20boolean,%20boolean,%20android.content.DialogInterface.OnCancelListener)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/CharSequence title, https://developer.android.com/reference/java/lang/CharSequence message, boolean indeterminate, boolean cancelable, https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener cancelListener) ` Creates and shows a ProgressDialog. |
| ` static https://developer.android.com/reference/android/app/ProgressDialog` | ` https://developer.android.com/reference/android/app/ProgressDialog#show(android.content.Context,%20java.lang.CharSequence,%20java.lang.CharSequence,%20boolean,%20boolean)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/CharSequence title, https://developer.android.com/reference/java/lang/CharSequence message, boolean indeterminate, boolean cancelable) ` Creates and shows a ProgressDialog. |
| ` static https://developer.android.com/reference/android/app/ProgressDialog` | ` https://developer.android.com/reference/android/app/ProgressDialog#show(android.content.Context,%20java.lang.CharSequence,%20java.lang.CharSequence,%20boolean)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/CharSequence title, https://developer.android.com/reference/java/lang/CharSequence message, boolean indeterminate) ` Creates and shows a ProgressDialog. |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Similar to `https://developer.android.com/reference/android/app/Activity#onCreate(android.os.Bundle)`, you should initialize your dialog in this method, including calling `https://developer.android.com/reference/android/app/Dialog#setContentView(android.view.View)`. |
| ` void` | ` https://developer.android.com/reference/android/app/ProgressDialog#onStop()() ` Called to tell you that you're stopping. |

### Inherited methods

From class ` https://developer.android.com/reference/android/app/AlertDialog ` ` https://developer.android.com/reference/android/widget/Button` ` https://developer.android.com/reference/android/app/AlertDialog#getButton(int)(int whichButton) `

Gets one of the buttons used in the dialog.
` https://developer.android.com/reference/android/widget/ListView` ` https://developer.android.com/reference/android/app/AlertDialog#getListView()() `

Gets the list view used in the dialog.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

Similar to `https://developer.android.com/reference/android/app/Activity#onCreate(android.os.Bundle)`, you should initialize your dialog in this method, including calling `https://developer.android.com/reference/android/app/Dialog#setContentView(android.view.View)`.
` boolean` ` https://developer.android.com/reference/android/app/AlertDialog#onKeyDown(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

A key was pressed down.
` boolean` ` https://developer.android.com/reference/android/app/AlertDialog#onKeyUp(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

A key was released.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton(java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/content/DialogInterface.OnClickListener listener) `

*This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener)` with `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_POSITIVE`*
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener)(int whichButton, https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/content/DialogInterface.OnClickListener listener) `

Set a listener to be invoked when the specified button of the dialog is pressed.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton(java.lang.CharSequence,%20android.os.Message)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/os/Message msg) `

*This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.os.Message)` with `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_POSITIVE`.*
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.os.Message)(int whichButton, https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/os/Message msg) `

Set a message to be sent when a button is pressed.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton2(java.lang.CharSequence,%20android.os.Message)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/os/Message msg) `

*This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.os.Message)` with `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEGATIVE`.*
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton2(java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/content/DialogInterface.OnClickListener listener) `

*This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener)` with `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEGATIVE`*
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton3(java.lang.CharSequence,%20android.os.Message)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/os/Message msg) `

*This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.os.Message)` with `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEUTRAL`.*
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setButton3(java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener)(https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/android/content/DialogInterface.OnClickListener listener) `

*This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/app/AlertDialog#setButton(int,%20java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener)` with `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEUTRAL`*
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setCustomTitle(android.view.View)(https://developer.android.com/reference/android/view/View customTitleView) ` ` void` ` https://developer.android.com/reference/android/app/AlertDialog#setIcon(android.graphics.drawable.Drawable)(https://developer.android.com/reference/android/graphics/drawable/Drawable icon) ` ` void` ` https://developer.android.com/reference/android/app/AlertDialog#setIcon(int)(int resId) `

Set resId to 0 if you don't want an icon.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setIconAttribute(int)(int attrId) `

Set an icon as supplied by a theme attribute.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setInverseBackgroundForced(boolean)(boolean forceInverseBackground) ` ` void` ` https://developer.android.com/reference/android/app/AlertDialog#setMessage(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence message) ` ` void` ` https://developer.android.com/reference/android/app/AlertDialog#setTitle(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence title) `

Set the title text for this dialog's window.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setView(android.view.View,%20int,%20int,%20int,%20int)(https://developer.android.com/reference/android/view/View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) `

Set the view to display in that dialog, specifying the spacing to appear around that view.
` void` ` https://developer.android.com/reference/android/app/AlertDialog#setView(android.view.View)(https://developer.android.com/reference/android/view/View view) `

Set the view to display in that dialog.
From class ` https://developer.android.com/reference/android/app/Dialog ` ` void` ` https://developer.android.com/reference/android/app/Dialog#addContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/view/ViewGroup.LayoutParams params) `

Add an additional content view to the screen.
` void` ` https://developer.android.com/reference/android/app/Dialog#cancel()() `

Cancel the dialog.
` void` ` https://developer.android.com/reference/android/app/Dialog#closeOptionsMenu()() ` ` void` ` https://developer.android.com/reference/android/app/Dialog#create()() `

Forces immediate creation of the dialog.
` void` ` https://developer.android.com/reference/android/app/Dialog#dismiss()() `

Dismiss this dialog, removing it from the screen.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#dispatchGenericMotionEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent ev) `

Called to process generic motion events.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#dispatchKeyEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent event) `

Called to process key events.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#dispatchKeyShortcutEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent event) `

Called to process a key shortcut event.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)(https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent event) `

Called to process population of `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent`s.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#dispatchTouchEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent ev) `

Called to process touch screen events.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#dispatchTrackballEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent ev) `

Called to process trackball events.
` <T extends https://developer.android.com/reference/android/view/View> T` ` https://developer.android.com/reference/android/app/Dialog#findViewById(int)(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 `https://developer.android.com/reference/android/app/Dialog#show()` or `https://developer.android.com/reference/android/app/Dialog#create()`).
` https://developer.android.com/reference/android/app/ActionBar` ` https://developer.android.com/reference/android/app/Dialog#getActionBar()() `

Retrieve the `https://developer.android.com/reference/android/app/ActionBar` attached to this dialog, if present.
` final https://developer.android.com/reference/android/content/Context` ` https://developer.android.com/reference/android/app/Dialog#getContext()() `

Retrieve the Context this Dialog is running in.
` https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/app/Dialog#getCurrentFocus()() `

Call `https://developer.android.com/reference/android/view/Window#getCurrentFocus()` on the Window if this Activity to return the currently focused view.
` https://developer.android.com/reference/android/view/LayoutInflater` ` https://developer.android.com/reference/android/app/Dialog#getLayoutInflater()() ` ` https://developer.android.com/reference/android/window/OnBackInvokedDispatcher` ` https://developer.android.com/reference/android/app/Dialog#getOnBackInvokedDispatcher()() `

Returns the `https://developer.android.com/reference/android/window/OnBackInvokedDispatcher` instance associated with the window that this dialog is attached to.
` final https://developer.android.com/reference/android/app/Activity` ` https://developer.android.com/reference/android/app/Dialog#getOwnerActivity()() `

Returns the Activity that owns this Dialog.
` final https://developer.android.com/reference/android/view/SearchEvent` ` https://developer.android.com/reference/android/app/Dialog#getSearchEvent()() `

During the onSearchRequested() callbacks, this function will return the `https://developer.android.com/reference/android/view/SearchEvent` that triggered the callback, if it exists.
` final int` ` https://developer.android.com/reference/android/app/Dialog#getVolumeControlStream()() ` ` https://developer.android.com/reference/android/view/Window` ` https://developer.android.com/reference/android/app/Dialog#getWindow()() `

Retrieve the current Window for the activity.
` void` ` https://developer.android.com/reference/android/app/Dialog#hide()() `

Hide the dialog, but do not dismiss it.
` void` ` https://developer.android.com/reference/android/app/Dialog#invalidateOptionsMenu()() ` ` boolean` ` https://developer.android.com/reference/android/app/Dialog#isShowing()() ` ` void` ` https://developer.android.com/reference/android/app/Dialog#onActionModeFinished(android.view.ActionMode)(https://developer.android.com/reference/android/view/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` ` https://developer.android.com/reference/android/app/Dialog#onActionModeStarted(android.view.ActionMode)(https://developer.android.com/reference/android/view/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` ` https://developer.android.com/reference/android/app/Dialog#onAttachedToWindow()() `

Called when the window has been attached to the window manager.
` void` ` https://developer.android.com/reference/android/app/Dialog#onBackPressed()() `

*This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/window/OnBackInvokedCallback` or `androidx.activity.OnBackPressedCallback` to handle back navigation instead.*

*Starting from Android 13 (API level 33), back event handling is moving to an ahead-of-time model and `https://developer.android.com/reference/android/app/Dialog#onBackPressed()` and `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_BACK` should not be used to handle back events (back gesture or back button click). Instead, an `https://developer.android.com/reference/android/window/OnBackInvokedCallback` should be registered using `https://developer.android.com/reference/android/app/Dialog#getOnBackInvokedDispatcher()` `https://developer.android.com/reference/android/window/OnBackInvokedDispatcher#registerOnBackInvokedCallback(int,%20android.window.OnBackInvokedCallback)`.*
` void` ` https://developer.android.com/reference/android/app/Dialog#onContentChanged()() `

This hook is called whenever the content view of the screen changes (due to a call to `https://developer.android.com/reference/android/view/Window#setContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)` or `https://developer.android.com/reference/android/view/Window#addContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)`).
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onContextItemSelected(android.view.MenuItem)(https://developer.android.com/reference/android/view/MenuItem item) ` ` void` ` https://developer.android.com/reference/android/app/Dialog#onContextMenuClosed(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu) ` ` void` ` https://developer.android.com/reference/android/app/Dialog#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

Similar to `https://developer.android.com/reference/android/app/Activity#onCreate(android.os.Bundle)`, you should initialize your dialog in this method, including calling `https://developer.android.com/reference/android/app/Dialog#setContentView(android.view.View)`.
` void` ` https://developer.android.com/reference/android/app/Dialog#onCreateContextMenu(android.view.ContextMenu,%20android.view.View,%20android.view.ContextMenu.ContextMenuInfo)(https://developer.android.com/reference/android/view/ContextMenu menu, https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo menuInfo) `

Called when the context menu for this view is being built.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onCreateOptionsMenu(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu) `

It is usually safe to proxy this call to the owner activity's `https://developer.android.com/reference/android/app/Activity#onCreateOptionsMenu(android.view.Menu)` if the client desires the same menu for this Dialog.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onCreatePanelMenu(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) `

Initialize the contents of the menu for panel 'featureId'.
` https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/app/Dialog#onCreatePanelView(int)(int featureId) `

Instantiate the view to display in the panel for 'featureId'.
` void` ` https://developer.android.com/reference/android/app/Dialog#onDetachedFromWindow()() `

Called when the window has been detached from the window manager.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onGenericMotionEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) `

Called when a generic motion event was not handled by any of the views inside of the dialog.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onKeyDown(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

A key was pressed down.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onKeyLongPress(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Default implementation of `https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyLongPress(int,%20android.view.KeyEvent)`: always returns false (doesn't handle the event).
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onKeyMultiple(int,%20int,%20android.view.KeyEvent)(int keyCode, int repeatCount, https://developer.android.com/reference/android/view/KeyEvent event) `

Default implementation of `https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyMultiple(int,%20int,%20android.view.KeyEvent)`: always returns false (doesn't handle the event).
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onKeyShortcut(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a key shortcut event is not handled by any of the views in the Dialog.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onKeyUp(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

A key was released.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onMenuItemSelected(int,%20android.view.MenuItem)(int featureId, https://developer.android.com/reference/android/view/MenuItem item) `

Called when a panel's menu item has been selected by the user.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onMenuOpened(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) `

Called when a panel's menu is opened by the user.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onOptionsItemSelected(android.view.MenuItem)(https://developer.android.com/reference/android/view/MenuItem item) ` ` void` ` https://developer.android.com/reference/android/app/Dialog#onOptionsMenuClosed(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu) ` ` void` ` https://developer.android.com/reference/android/app/Dialog#onPanelClosed(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) `

Called when a panel is being closed.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onPrepareOptionsMenu(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu) `

It is usually safe to proxy this call to the owner activity's `https://developer.android.com/reference/android/app/Activity#onPrepareOptionsMenu(android.view.Menu)` if the client desires the same menu for this Dialog.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onPreparePanel(int,%20android.view.View,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/view/Menu menu) `

Prepare a panel to be displayed.
` void` ` https://developer.android.com/reference/android/app/Dialog#onRestoreInstanceState(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

Restore the state of the dialog from a previously saved bundle.
` https://developer.android.com/reference/android/os/Bundle` ` https://developer.android.com/reference/android/app/Dialog#onSaveInstanceState()() `

Saves the state of the dialog into a bundle.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onSearchRequested(android.view.SearchEvent)(https://developer.android.com/reference/android/view/SearchEvent searchEvent) `

This hook is called when the user signals the desire to start a search.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onSearchRequested()() `

This hook is called when the user signals the desire to start a search.
` void` ` https://developer.android.com/reference/android/app/Dialog#onStart()() `

Called when the dialog is starting.
` void` ` https://developer.android.com/reference/android/app/Dialog#onStop()() `

Called to tell you that you're stopping.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onTouchEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) `

Called when a touch screen event was not handled by any of the views under it.
` boolean` ` https://developer.android.com/reference/android/app/Dialog#onTrackballEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) `

Called when the trackball was moved and not handled by any of the views inside of the activity.
` void` ` https://developer.android.com/reference/android/app/Dialog#onWindowAttributesChanged(android.view.WindowManager.LayoutParams)(https://developer.android.com/reference/android/view/WindowManager.LayoutParams params) `

This is called whenever the current window attributes change.
` void` ` https://developer.android.com/reference/android/app/Dialog#onWindowFocusChanged(boolean)(boolean hasFocus) `

This hook is called whenever the window focus changes.
` https://developer.android.com/reference/android/view/ActionMode` ` https://developer.android.com/reference/android/app/Dialog#onWindowStartingActionMode(android.view.ActionMode.Callback)(https://developer.android.com/reference/android/view/ActionMode.Callback callback) `

Called when an action mode is being started for this window.
` https://developer.android.com/reference/android/view/ActionMode` ` https://developer.android.com/reference/android/app/Dialog#onWindowStartingActionMode(android.view.ActionMode.Callback,%20int)(https://developer.android.com/reference/android/view/ActionMode.Callback callback, int type) `

Called when an action mode is being started for this window.
` void` ` https://developer.android.com/reference/android/app/Dialog#openContextMenu(android.view.View)(https://developer.android.com/reference/android/view/View view) ` ` void` ` https://developer.android.com/reference/android/app/Dialog#openOptionsMenu()() ` ` void` ` https://developer.android.com/reference/android/app/Dialog#registerForContextMenu(android.view.View)(https://developer.android.com/reference/android/view/View view) ` ` final boolean` ` https://developer.android.com/reference/android/app/Dialog#requestWindowFeature(int)(int featureId) `

Enable extended window features.
` final <T extends https://developer.android.com/reference/android/view/View> T` ` https://developer.android.com/reference/android/app/Dialog#requireViewById(int)(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 `https://developer.android.com/reference/android/app/Dialog#show()` or `https://developer.android.com/reference/android/app/Dialog#create()`).
` void` ` https://developer.android.com/reference/android/app/Dialog#setCancelMessage(android.os.Message)(https://developer.android.com/reference/android/os/Message msg) `

Set a message to be sent when the dialog is canceled.
` void` ` https://developer.android.com/reference/android/app/Dialog#setCancelable(boolean)(boolean flag) `

Sets whether this dialog is cancelable with the `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_BACK` key.
` void` ` https://developer.android.com/reference/android/app/Dialog#setCanceledOnTouchOutside(boolean)(boolean cancel) `

Sets whether this dialog is canceled when touched outside the window's bounds.
` void` ` https://developer.android.com/reference/android/app/Dialog#setContentView(int)(int layoutResID) `

Set the screen content from a layout resource.
` void` ` https://developer.android.com/reference/android/app/Dialog#setContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/view/ViewGroup.LayoutParams params) `

Set the screen content to an explicit view.
` void` ` https://developer.android.com/reference/android/app/Dialog#setContentView(android.view.View)(https://developer.android.com/reference/android/view/View view) `

Set the screen content to an explicit view.
` void` ` https://developer.android.com/reference/android/app/Dialog#setDismissMessage(android.os.Message)(https://developer.android.com/reference/android/os/Message msg) `

Set a message to be sent when the dialog is dismissed.
` final void` ` https://developer.android.com/reference/android/app/Dialog#setFeatureDrawable(int,%20android.graphics.drawable.Drawable)(int featureId, https://developer.android.com/reference/android/graphics/drawable/Drawable drawable) `

Convenience for calling `https://developer.android.com/reference/android/view/Window#setFeatureDrawable(int,%20android.graphics.drawable.Drawable)`.
` final void` ` https://developer.android.com/reference/android/app/Dialog#setFeatureDrawableAlpha(int,%20int)(int featureId, int alpha) `

Convenience for calling `https://developer.android.com/reference/android/view/Window#setFeatureDrawableAlpha(int,%20int)`.
` final void` ` https://developer.android.com/reference/android/app/Dialog#setFeatureDrawableResource(int,%20int)(int featureId, int resId) `

Convenience for calling `https://developer.android.com/reference/android/view/Window#setFeatureDrawableResource(int,%20int)`.
` final void` ` https://developer.android.com/reference/android/app/Dialog#setFeatureDrawableUri(int,%20android.net.Uri)(int featureId, https://developer.android.com/reference/android/net/Uri uri) `

Convenience for calling `https://developer.android.com/reference/android/view/Window#setFeatureDrawableUri(int,%20android.net.Uri)`.
` void` ` https://developer.android.com/reference/android/app/Dialog#setOnCancelListener(android.content.DialogInterface.OnCancelListener)(https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener listener) `

Set a listener to be invoked when the dialog is canceled.
` void` ` https://developer.android.com/reference/android/app/Dialog#setOnDismissListener(android.content.DialogInterface.OnDismissListener)(https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener listener) `

Set a listener to be invoked when the dialog is dismissed.
` void` ` https://developer.android.com/reference/android/app/Dialog#setOnKeyListener(android.content.DialogInterface.OnKeyListener)(https://developer.android.com/reference/android/content/DialogInterface.OnKeyListener onKeyListener) `

Sets the callback that will be called if a key is dispatched to the dialog.
` void` ` https://developer.android.com/reference/android/app/Dialog#setOnShowListener(android.content.DialogInterface.OnShowListener)(https://developer.android.com/reference/android/content/DialogInterface.OnShowListener listener) `

Sets a listener to be invoked when the dialog is shown.
` final void` ` https://developer.android.com/reference/android/app/Dialog#setOwnerActivity(android.app.Activity)(https://developer.android.com/reference/android/app/Activity activity) `

Sets the Activity that owns this dialog.
` void` ` https://developer.android.com/reference/android/app/Dialog#setTitle(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence title) `

Set the title text for this dialog's window.
` void` ` https://developer.android.com/reference/android/app/Dialog#setTitle(int)(int titleId) `

Set the title text for this dialog's window.
` final void` ` https://developer.android.com/reference/android/app/Dialog#setVolumeControlStream(int)(int streamType) `

By default, this will use the owner Activity's suggested stream type.
` void` ` https://developer.android.com/reference/android/app/Dialog#show()() `

Start the dialog and display it on screen.
` void` ` https://developer.android.com/reference/android/app/Dialog#takeKeyEvents(boolean)(boolean get) `

Request that key events come to this dialog.
` void` ` https://developer.android.com/reference/android/app/Dialog#unregisterForContextMenu(android.view.View)(https://developer.android.com/reference/android/view/View view) ` From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/content/DialogInterface ` ` abstract void` ` https://developer.android.com/reference/android/content/DialogInterface#cancel()() `

Cancels the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener`.
` abstract void` ` https://developer.android.com/reference/android/content/DialogInterface#dismiss()() `

Dismisses the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener`.
From interface ` https://developer.android.com/reference/android/view/KeyEvent.Callback ` ` abstract boolean` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyDown(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a key down event has occurred.
` abstract boolean` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyLongPress(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a long press has occurred.
` abstract boolean` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyMultiple(int,%20int,%20android.view.KeyEvent)(int keyCode, int count, https://developer.android.com/reference/android/view/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` ` https://developer.android.com/reference/android/view/KeyEvent.Callback#onKeyUp(int,%20android.view.KeyEvent)(int keyCode, https://developer.android.com/reference/android/view/KeyEvent event) `

Called when a key up event has occurred.
From interface ` https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener ` ` abstract void` ` https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener#onCreateContextMenu(android.view.ContextMenu,%20android.view.View,%20android.view.ContextMenu.ContextMenuInfo)(https://developer.android.com/reference/android/view/ContextMenu menu, https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo menuInfo) `

Called when the context menu for this view is being built.
From interface ` https://developer.android.com/reference/android/view/Window.Callback ` ` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#dispatchGenericMotionEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) `

Called to process generic motion events.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#dispatchKeyEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent event) `

Called to process key events.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#dispatchKeyShortcutEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent event) `

Called to process a key shortcut event.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)(https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent event) `

Called to process population of `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent`s.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#dispatchTouchEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) `

Called to process touch screen events.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#dispatchTrackballEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) `

Called to process trackball events.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onActionModeFinished(android.view.ActionMode)(https://developer.android.com/reference/android/view/ActionMode mode) `

Called when an action mode has been finished.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onActionModeStarted(android.view.ActionMode)(https://developer.android.com/reference/android/view/ActionMode mode) `

Called when an action mode has been started.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onAttachedToWindow()() `

Called when the window has been attached to the window manager.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onContentChanged()() `

This hook is called whenever the content view of the screen changes (due to a call to `https://developer.android.com/reference/android/view/Window#setContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)` or `https://developer.android.com/reference/android/view/Window#addContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)`).
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#onCreatePanelMenu(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) `

Initialize the contents of the menu for panel 'featureId'.
` abstract https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/view/Window.Callback#onCreatePanelView(int)(int featureId) `

Instantiate the view to display in the panel for 'featureId'.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onDetachedFromWindow()() `

Called when the window has been detached from the window manager.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#onMenuItemSelected(int,%20android.view.MenuItem)(int featureId, https://developer.android.com/reference/android/view/MenuItem item) `

Called when a panel's menu item has been selected by the user.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#onMenuOpened(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) `

Called when a panel's menu is opened by the user.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onPanelClosed(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) `

Called when a panel is being closed.
` default void` ` https://developer.android.com/reference/android/view/Window.Callback#onPointerCaptureChanged(boolean)(boolean hasCapture) `

Called when pointer capture is enabled or disabled for the current window.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#onPreparePanel(int,%20android.view.View,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/view/Menu menu) `

Prepare a panel to be displayed.
` default void` ` https://developer.android.com/reference/android/view/Window.Callback#onProvideKeyboardShortcuts(java.util.List<android.view.KeyboardShortcutGroup>,%20android.view.Menu,%20int)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/view/KeyboardShortcutGroup> data, https://developer.android.com/reference/android/view/Menu menu, int deviceId) `

Called when Keyboard Shortcuts are requested for the current window.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#onSearchRequested()() `

Called when the user signals the desire to start a search.
` abstract boolean` ` https://developer.android.com/reference/android/view/Window.Callback#onSearchRequested(android.view.SearchEvent)(https://developer.android.com/reference/android/view/SearchEvent searchEvent) `

Called when the user signals the desire to start a search.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onWindowAttributesChanged(android.view.WindowManager.LayoutParams)(https://developer.android.com/reference/android/view/WindowManager.LayoutParams attrs) `

This is called whenever the current window attributes change.
` abstract void` ` https://developer.android.com/reference/android/view/Window.Callback#onWindowFocusChanged(boolean)(boolean hasFocus) `

This hook is called whenever the window focus changes.
` abstract https://developer.android.com/reference/android/view/ActionMode` ` https://developer.android.com/reference/android/view/Window.Callback#onWindowStartingActionMode(android.view.ActionMode.Callback)(https://developer.android.com/reference/android/view/ActionMode.Callback callback) `

Called when an action mode is being started for this window.
` abstract https://developer.android.com/reference/android/view/ActionMode` ` https://developer.android.com/reference/android/view/Window.Callback#onWindowStartingActionMode(android.view.ActionMode.Callback,%20int)(https://developer.android.com/reference/android/view/ActionMode.Callback callback, int type) `

Called when an action mode is being started for this window.

## Constants

### STYLE_HORIZONTAL

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_HORIZONTAL
```

Creates a ProgressDialog with a horizontal progress bar.

<br />

Constant Value: 1 (0x00000001)

### STYLE_SPINNER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_SPINNER
```

Creates a ProgressDialog with a circular, spinning progress bar. This is the default.

<br />

Constant Value: 0 (0x00000000)

## Public constructors

### ProgressDialog

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ProgressDialog (Context context)
```

Creates a Progress dialog.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the parent context <br /> |

### ProgressDialog

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ProgressDialog (Context context, 
                int theme)
```

Creates a Progress dialog.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the parent context <br /> |
| `theme` | `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 <br /> |

## Public methods

### getMax

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getMax ()
```

Gets the maximum allowed progress value. The default value is 100.

<br />

| Returns ||
|---|---|
| `int` | the maximum value <br /> |

### getProgress

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getProgress ()
```

Gets the current progress.

<br />

| Returns ||
|---|---|
| `int` | the current progress, a value between 0 and `https://developer.android.com/reference/android/app/ProgressDialog#getMax()` <br /> |

### getSecondaryProgress

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getSecondaryProgress ()
```

Gets the current secondary progress.

<br />

| Returns ||
|---|---|
| `int` | the current secondary progress, a value between 0 and `https://developer.android.com/reference/android/app/ProgressDialog#getMax()` <br /> |

### incrementProgressBy

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void incrementProgressBy (int diff)
```

Increments the current progress value.

<br />

| Parameters ||
|---|---|
| `diff` | `int`: the amount by which the current progress will be incremented, up to `https://developer.android.com/reference/android/app/ProgressDialog#getMax()` <br /> |

### incrementSecondaryProgressBy

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void incrementSecondaryProgressBy (int diff)
```

Increments the current secondary progress value.

<br />

| Parameters ||
|---|---|
| `diff` | `int`: the amount by which the current secondary progress will be incremented, up to `https://developer.android.com/reference/android/app/ProgressDialog#getMax()` <br /> |

### isIndeterminate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isIndeterminate ()
```

Whether this ProgressDialog is in indeterminate mode.

<br />

| Returns ||
|---|---|
| `boolean` | true if the dialog is in indeterminate mode, false otherwise <br /> |

### onStart

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onStart ()
```

Called when the dialog is starting.

<br />

### setIndeterminate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setIndeterminate (boolean indeterminate)
```

Change the indeterminate mode for this ProgressDialog. In indeterminate mode, the progress is ignored and the dialog shows an infinite animation instead.

**Note:** A ProgressDialog with style `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_SPINNER` is always indeterminate and will ignore this setting.

<br />

<br />

| Parameters ||
|---|---|
| `indeterminate` | `boolean`: true to enable indeterminate mode, false otherwise <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ProgressDialog#setProgressStyle(int)`

### setIndeterminateDrawable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setIndeterminateDrawable (Drawable d)
```

Sets the drawable to be used to display the indeterminate progress value.

<br />

| Parameters ||
|---|---|
| `d` | `Drawable`: the drawable to be used <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/ProgressBar#setProgressDrawable(android.graphics.drawable.Drawable)`
- `https://developer.android.com/reference/android/app/ProgressDialog#setIndeterminate(boolean)`

### setMax

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setMax (int max)
```

Sets the maximum allowed progress value.

<br />

| Parameters ||
|---|---|
| `max` | `int` <br /> |

### setMessage

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setMessage (CharSequence message)
```

<br />

<br />

| Parameters ||
|---|---|
| `message` | `CharSequence` <br /> |

### setProgress

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setProgress (int value)
```

Sets the current progress.

<br />

| Parameters ||
|---|---|
| `value` | `int`: the current progress, a value between 0 and `https://developer.android.com/reference/android/app/ProgressDialog#getMax()` <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/ProgressBar#setProgress(int)`

### setProgressDrawable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setProgressDrawable (Drawable d)
```

Sets the drawable to be used to display the progress value.

<br />

| Parameters ||
|---|---|
| `d` | `Drawable`: the drawable to be used <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/ProgressBar#setProgressDrawable(android.graphics.drawable.Drawable)`

### setProgressNumberFormat

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setProgressNumberFormat (String format)
```

Change the format of the small text showing current and maximum units of progress. The default is "%1d/%2d". Should not be called during the number is progressing.

<br />

| Parameters ||
|---|---|
| `format` | `String`: A string passed to `https://developer.android.com/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])`; use "%1d" for the current number and "%2d" for the maximum. If null, nothing will be shown. <br /> |

### setProgressPercentFormat

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setProgressPercentFormat (NumberFormat format)
```

Change the format of the small text showing the percentage of progress. The default is `https://developer.android.com/reference/java/text/NumberFormat#getPercentInstance()` Should not be called during the number is progressing.

<br />

| Parameters ||
|---|---|
| `format` | `NumberFormat`: An instance of a `https://developer.android.com/reference/java/text/NumberFormat` to generate the percentage text. If null, nothing will be shown. <br /> |

### setProgressStyle

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setProgressStyle (int style)
```

Sets the style of this ProgressDialog, either `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_SPINNER` or `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_HORIZONTAL`. The default is `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_SPINNER`.

**Note:** A ProgressDialog with style `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_SPINNER` is always indeterminate and will ignore the `https://developer.android.com/reference/android/app/ProgressDialog#setIndeterminate(boolean)` setting.

<br />

<br />

| Parameters ||
|---|---|
| `style` | `int`: the style of this ProgressDialog, either `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_SPINNER` or `https://developer.android.com/reference/android/app/ProgressDialog#STYLE_HORIZONTAL` <br /> |

### setSecondaryProgress

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSecondaryProgress (int secondaryProgress)
```

Sets the secondary progress.

<br />

| Parameters ||
|---|---|
| `secondaryProgress` | `int`: the current secondary progress, a value between 0 and `https://developer.android.com/reference/android/app/ProgressDialog#getMax()` <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/ProgressBar#setSecondaryProgress(int)`

### show

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message)
```

Creates and shows a ProgressDialog.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the parent context <br /> |
| `title` | `CharSequence`: the title text for the dialog's window <br /> |
| `message` | `CharSequence`: the text to be displayed in the dialog <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ProgressDialog` | the ProgressDialog <br /> |

### show

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate, 
                boolean cancelable, 
                DialogInterface.OnCancelListener cancelListener)
```

Creates and shows a ProgressDialog.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the parent context <br /> |
| `title` | `CharSequence`: the title text for the dialog's window <br /> |
| `message` | `CharSequence`: the text to be displayed in the dialog <br /> |
| `indeterminate` | `boolean`: true if the dialog should be `https://developer.android.com/reference/android/app/ProgressDialog#setIndeterminate(boolean)`, false otherwise <br /> |
| `cancelable` | `boolean`: true if the dialog is `https://developer.android.com/reference/android/app/Dialog#setCancelable(boolean)`, false otherwise <br /> |
| `cancelListener` | `DialogInterface.OnCancelListener`: the `https://developer.android.com/reference/android/app/Dialog#setOnCancelListener(android.content.DialogInterface.OnCancelListener)` to be invoked when the dialog is canceled <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ProgressDialog` | the ProgressDialog <br /> |

### show

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate, 
                boolean cancelable)
```

Creates and shows a ProgressDialog.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the parent context <br /> |
| `title` | `CharSequence`: the title text for the dialog's window <br /> |
| `message` | `CharSequence`: the text to be displayed in the dialog <br /> |
| `indeterminate` | `boolean`: true if the dialog should be `https://developer.android.com/reference/android/app/ProgressDialog#setIndeterminate(boolean)`, false otherwise <br /> |
| `cancelable` | `boolean`: true if the dialog is `https://developer.android.com/reference/android/app/Dialog#setCancelable(boolean)`, false otherwise <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ProgressDialog` | the ProgressDialog <br /> |

### show

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate)
```

Creates and shows a ProgressDialog.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the parent context <br /> |
| `title` | `CharSequence`: the title text for the dialog's window <br /> |
| `message` | `CharSequence`: the text to be displayed in the dialog <br /> |
| `indeterminate` | `boolean`: true if the dialog should be `https://developer.android.com/reference/android/app/ProgressDialog#setIndeterminate(boolean)`, false otherwise <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/ProgressDialog` | the ProgressDialog <br /> |

## Protected methods

### onCreate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Similar to `https://developer.android.com/reference/android/app/Activity#onCreate(android.os.Bundle)`, you should initialize your dialog in this method, including calling `https://developer.android.com/reference/android/app/Dialog#setContentView(android.view.View)`.

<br />

| 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 `https://developer.android.com/reference/android/app/Dialog#onSaveInstanceState()`, or null if this is the first time. <br /> |

### onStop

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected void onStop ()
```

Called to tell you that you're stopping.

<br />