ProgressDialog


public class ProgressDialog
extends AlertDialog

java.lang.Object
   ↳ android.app.Dialog
     ↳ android.app.AlertDialog
       ↳ android.app.ProgressDialog


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

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

Summary

Constants

int STYLE_HORIZONTAL

Creates a ProgressDialog with a horizontal progress bar.

int STYLE_SPINNER

Creates a ProgressDialog with a circular, spinning progress bar.

Inherited constants

int THEME_DEVICE_DEFAULT_DARK

This constant was deprecated in API level 23. Use R.style.Theme_DeviceDefault_Dialog_Alert.

int THEME_DEVICE_DEFAULT_LIGHT

This constant was deprecated in API level 23. Use R.style.Theme_DeviceDefault_Light_Dialog_Alert.

int THEME_HOLO_DARK

This constant was deprecated in API level 23. Use R.style.Theme_Material_Dialog_Alert.

int THEME_HOLO_LIGHT

This constant was deprecated in API level 23. Use R.style.Theme_Material_Light_Dialog_Alert.

int THEME_TRADITIONAL

This constant was deprecated in API level 23. Use R.style.Theme_Material_Dialog_Alert.

int BUTTON1

This constant was deprecated in API level 15. Use BUTTON_POSITIVE

int BUTTON2

This constant was deprecated in API level 15. Use BUTTON_NEGATIVE

int BUTTON3

This constant was deprecated in API level 15. 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

ProgressDialog(Context context)

Creates a Progress dialog.

ProgressDialog(Context context, int theme)

Creates a Progress dialog.

Public methods

int getMax()

Gets the maximum allowed progress value.

int getProgress()

Gets the current progress.

int getSecondaryProgress()

Gets the current secondary progress.

void incrementProgressBy(int diff)

Increments the current progress value.

void incrementSecondaryProgressBy(int diff)

Increments the current secondary progress value.

boolean isIndeterminate()

Whether this ProgressDialog is in indeterminate mode.

void onStart()

Called when the dialog is starting.

void setIndeterminate(boolean indeterminate)

Change the indeterminate mode for this ProgressDialog.

void setIndeterminateDrawable(Drawable d)

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

void setMax(int max)

Sets the maximum allowed progress value.

void setMessage(CharSequence message)
void setProgress(int value)

Sets the current progress.

void setProgressDrawable(Drawable d)

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

void setProgressNumberFormat(String format)

Change the format of the small text showing current and maximum units of progress.

void setProgressPercentFormat(NumberFormat format)

Change the format of the small text showing the percentage of progress.

void setProgressStyle(int style)

Sets the style of this ProgressDialog, either STYLE_SPINNER or STYLE_HORIZONTAL.

void setSecondaryProgress(int secondaryProgress)

Sets the secondary progress.

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

Creates and shows a ProgressDialog.

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

Creates and shows a ProgressDialog.

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

Creates and shows a ProgressDialog.

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

Creates and shows a ProgressDialog.

Protected methods

void onCreate(Bundle savedInstanceState)

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

void onStop()

Called to tell you that you're stopping.

Inherited methods

Button getButton(int whichButton)

Gets one of the buttons used in the dialog.

ListView getListView()

Gets the list view used in the dialog.

void onCreate(Bundle savedInstanceState)

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

boolean onKeyDown(int keyCode, KeyEvent event)

A key was pressed down.

boolean onKeyUp(int keyCode, KeyEvent event)

A key was released.

void setButton(CharSequence text, DialogInterface.OnClickListener listener)

This method was deprecated in API level 15. Use setButton(int, java.lang.CharSequence, android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_POSITIVE

void setButton(int whichButton, CharSequence text, DialogInterface.OnClickListener listener)

Set a listener to be invoked when the specified button of the dialog is pressed.

void setButton(CharSequence text, Message msg)

This method was deprecated in API level 15. Use setButton(int, java.lang.CharSequence, android.os.Message) with DialogInterface.BUTTON_POSITIVE.

void setButton(int whichButton, CharSequence text, Message msg)

Set a message to be sent when a button is pressed.

void setButton2(CharSequence text, Message msg)

This method was deprecated in API level 15. Use setButton(int, java.lang.CharSequence, android.os.Message) with DialogInterface.BUTTON_NEGATIVE.

void setButton2(CharSequence text, DialogInterface.OnClickListener listener)

This method was deprecated in API level 15. Use setButton(int, java.lang.CharSequence, android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_NEGATIVE

void setButton3(CharSequence text, Message msg)

This method was deprecated in API level 15. Use setButton(int, java.lang.CharSequence, android.os.Message) with DialogInterface.BUTTON_NEUTRAL.

void setButton3(CharSequence text, DialogInterface.OnClickListener listener)

This method was deprecated in API level 15. Use setButton(int, java.lang.CharSequence, android.content.DialogInterface.OnClickListener) with DialogInterface.BUTTON_NEUTRAL

void setCustomTitle(View customTitleView)
void setIcon(Drawable icon)
void setIcon(int resId)

Set resId to 0 if you don't want an icon.

void setIconAttribute(int attrId)

Set an icon as supplied by a theme attribute.

void setInverseBackgroundForced(boolean forceInverseBackground)
void setMessage(CharSequence message)
void setTitle(CharSequence title)

Set the title text for this dialog's window.

void setView(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 setView(View view)

Set the view to display in that dialog.

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

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()
OnBackInvokedDispatcher getOnBackInvokedDispatcher()

Returns the OnBackInvokedDispatcher instance associated with the window that this dialog is attached to.

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()

This method was deprecated in API level 33. Use 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 onBackPressed() and KeyEvent.KEYCODE_BACK should not be used to handle back events (back gesture or back button click). Instead, an OnBackInvokedCallback should be registered using Dialog.getOnBackInvokedDispatcher() .registerOnBackInvokedCallback(priority, callback).

void onContentChanged()

This hook is called whenever the content view of the screen changes (due to a call to Window.setContentView or Window.addContentView).

boolean onContextItemSelected(MenuItem item)
void onContextMenuClosed(Menu menu)
void onCreate(Bundle savedInstanceState)

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

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(): always returns false (doesn't handle the event).

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

Default implementation of KeyEvent.Callback.onKeyMultiple(): 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.

void onStart()

Called when the dialog is starting.

void onStop()

Called to tell you that you're stopping.

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 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)
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 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 wait(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 wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract void cancel()

Cancels the dialog, invoking the OnCancelListener.

abstract void dismiss()

Dismisses the dialog, invoking the OnDismissListener.

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.

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

Called when the context menu for this view is being built.

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

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 or Window.addContentView).

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.

Constants

STYLE_HORIZONTAL

Added in API level 1
public static final int STYLE_HORIZONTAL

Creates a ProgressDialog with a horizontal progress bar.

Constant Value: 1 (0x00000001)

STYLE_SPINNER

Added in API level 1
public static final int STYLE_SPINNER

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

Constant Value: 0 (0x00000000)

Public constructors

ProgressDialog

Added in API level 1
public ProgressDialog (Context context)

Creates a Progress dialog.

Parameters
context Context: the parent context

ProgressDialog

Added in API level 1
public ProgressDialog (Context context, 
                int theme)

Creates a Progress dialog.

Parameters
context Context: the parent context

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

Public methods

getMax

Added in API level 1
public int getMax ()

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

Returns
int the maximum value

getProgress

Added in API level 1
public int getProgress ()

Gets the current progress.

Returns
int the current progress, a value between 0 and getMax()

getSecondaryProgress

Added in API level 1
public int getSecondaryProgress ()

Gets the current secondary progress.

Returns
int the current secondary progress, a value between 0 and getMax()

incrementProgressBy

Added in API level 1
public void incrementProgressBy (int diff)

Increments the current progress value.

Parameters
diff int: the amount by which the current progress will be incremented, up to getMax()

incrementSecondaryProgressBy

Added in API level 1
public void incrementSecondaryProgressBy (int diff)

Increments the current secondary progress value.

Parameters
diff int: the amount by which the current secondary progress will be incremented, up to getMax()

isIndeterminate

Added in API level 1
public boolean isIndeterminate ()

Whether this ProgressDialog is in indeterminate mode.

Returns
boolean true if the dialog is in indeterminate mode, false otherwise

onStart

Added in API level 1
public void onStart ()

Called when the dialog is starting.

setIndeterminate

Added in API level 1
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 STYLE_SPINNER is always indeterminate and will ignore this setting.

Parameters
indeterminate boolean: true to enable indeterminate mode, false otherwise

setIndeterminateDrawable

Added in API level 1
public void setIndeterminateDrawable (Drawable d)

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

Parameters
d Drawable: the drawable to be used

setMax

Added in API level 1
public void setMax (int max)

Sets the maximum allowed progress value.

Parameters
max int

setMessage

Added in API level 1
public void setMessage (CharSequence message)

Parameters
message CharSequence

setProgress

Added in API level 1
public void setProgress (int value)

Sets the current progress.

Parameters
value int: the current progress, a value between 0 and getMax()

setProgressDrawable

Added in API level 1
public void setProgressDrawable (Drawable d)

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

Parameters
d Drawable: the drawable to be used

setProgressNumberFormat

Added in API level 11
Deprecated in API level 26
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.

Parameters
format String: A string passed to String.format(); use "%1d" for the current number and "%2d" for the maximum. If null, nothing will be shown.

setProgressPercentFormat

Added in API level 11
Deprecated in API level 26
public void setProgressPercentFormat (NumberFormat format)

Change the format of the small text showing the percentage of progress. The default is NumberFormat.getPercentageInstnace(). Should not be called during the number is progressing.

Parameters
format NumberFormat: An instance of a NumberFormat to generate the percentage text. If null, nothing will be shown.

setProgressStyle

Added in API level 1
public void setProgressStyle (int style)

Sets the style of this ProgressDialog, either STYLE_SPINNER or STYLE_HORIZONTAL. The default is STYLE_SPINNER.

Note: A ProgressDialog with style STYLE_SPINNER is always indeterminate and will ignore the indeterminate setting.

Parameters
style int: the style of this ProgressDialog, either STYLE_SPINNER or STYLE_HORIZONTAL

setSecondaryProgress

Added in API level 1
public void setSecondaryProgress (int secondaryProgress)

Sets the secondary progress.

Parameters
secondaryProgress int: the current secondary progress, a value between 0 and getMax()

show

Added in API level 1
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message)

Creates and shows a ProgressDialog.

Parameters
context Context: the parent context

title CharSequence: the title text for the dialog's window

message CharSequence: the text to be displayed in the dialog

Returns
ProgressDialog the ProgressDialog

show

Added in API level 1
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate, 
                boolean cancelable, 
                DialogInterface.OnCancelListener cancelListener)

Creates and shows a ProgressDialog.

Parameters
context Context: the parent context

title CharSequence: the title text for the dialog's window

message CharSequence: the text to be displayed in the dialog

indeterminate boolean: true if the dialog should be indeterminate, false otherwise

cancelable boolean: true if the dialog is cancelable, false otherwise

cancelListener DialogInterface.OnCancelListener: the listener to be invoked when the dialog is canceled

Returns
ProgressDialog the ProgressDialog

show

Added in API level 1
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate, 
                boolean cancelable)

Creates and shows a ProgressDialog.

Parameters
context Context: the parent context

title CharSequence: the title text for the dialog's window

message CharSequence: the text to be displayed in the dialog

indeterminate boolean: true if the dialog should be indeterminate, false otherwise

cancelable boolean: true if the dialog is cancelable, false otherwise

Returns
ProgressDialog the ProgressDialog

show

Added in API level 1
public static ProgressDialog show (Context context, 
                CharSequence title, 
                CharSequence message, 
                boolean indeterminate)

Creates and shows a ProgressDialog.

Parameters
context Context: the parent context

title CharSequence: the title text for the dialog's window

message CharSequence: the text to be displayed in the dialog

indeterminate boolean: true if the dialog should be indeterminate, false otherwise

Returns
ProgressDialog the ProgressDialog

Protected methods

onCreate

Added in API level 1
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 Dialog.onSaveInstanceState(), or null if this is the first time.

onStop

Added in API level 1
protected void onStop ()

Called to tell you that you're stopping.