public class ProgressDialog extends AlertDialog
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..10000.
AlertDialog.Builder
DialogInterface.OnCancelListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, DialogInterface.OnKeyListener, DialogInterface.OnMultiChoiceClickListener, DialogInterface.OnShowListener
Modifier and Type | Field and Description |
---|---|
static int |
STYLE_HORIZONTAL
Creates a ProgressDialog with a horizontal progress bar.
|
static int |
STYLE_SPINNER
Creates a ProgressDialog with a circular, spinning progress
bar.
|
LAYOUT_HINT_NONE, LAYOUT_HINT_SIDE, THEME_DEVICE_DEFAULT_DARK, THEME_DEVICE_DEFAULT_LIGHT, THEME_HOLO_DARK, THEME_HOLO_LIGHT, THEME_TRADITIONAL
mCancelable
BUTTON_NEGATIVE, BUTTON_NEUTRAL, BUTTON_POSITIVE, BUTTON1, BUTTON2, BUTTON3
Constructor and Description |
---|
ProgressDialog(Context context) |
ProgressDialog(Context context,
int theme) |
Modifier and Type | Method and Description |
---|---|
int |
getMax() |
int |
getProgress() |
int |
getSecondaryProgress() |
void |
incrementProgressBy(int diff) |
void |
incrementSecondaryProgressBy(int diff) |
boolean |
isIndeterminate() |
protected void |
onCreate(Bundle savedInstanceState)
Similar to
Activity.onCreate(android.os.Bundle) , you should initialize your dialog
in this method, including calling Dialog.setContentView(int) . |
void |
onStart()
Called when the dialog is starting.
|
protected void |
onStop()
Called to tell you that you're stopping.
|
void |
setIndeterminate(boolean indeterminate) |
void |
setIndeterminateDrawable(Drawable d) |
void |
setMax(int max) |
void |
setMessage(CharSequence message) |
void |
setProgress(int value) |
void |
setProgressDrawable(Drawable d) |
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) |
void |
setSecondaryProgress(int secondaryProgress) |
static ProgressDialog |
show(Context context,
CharSequence title,
CharSequence message) |
static ProgressDialog |
show(Context context,
CharSequence title,
CharSequence message,
boolean indeterminate) |
static ProgressDialog |
show(Context context,
CharSequence title,
CharSequence message,
boolean indeterminate,
boolean cancelable) |
static ProgressDialog |
show(Context context,
CharSequence title,
CharSequence message,
boolean indeterminate,
boolean cancelable,
DialogInterface.OnCancelListener cancelListener) |
getButton, getListView, onKeyDown, onKeyUp, setButton, setButton, setButton, setButton, setButton2, setButton2, setButton3, setButton3, setCustomTitle, setIcon, setIcon, setIconAttribute, setInverseBackgroundForced, setTitle, setView, setView
addContentView, cancel, closeOptionsMenu, create, dismiss, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, getActionBar, getContext, getCurrentFocus, getLayoutInflater, getOwnerActivity, getSearchEvent, getVolumeControlStream, getWindow, hide, invalidateOptionsMenu, isShowing, onActionModeFinished, onActionModeStarted, onAttachedToWindow, onBackPressed, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onDetachedFromWindow, onGenericMotionEvent, onKeyLongPress, onKeyMultiple, onKeyShortcut, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPrepareOptionsMenu, onPreparePanel, onRestoreInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onTouchEvent, onTrackballEvent, onWindowAttributesChanged, onWindowDismissed, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, registerForContextMenu, requestWindowFeature, setCancelable, setCanceledOnTouchOutside, setCancelMessage, setContentView, setContentView, setContentView, setDismissMessage, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setOnCancelListener, setOnDismissListener, setOnKeyListener, setOnShowListener, setOwnerActivity, setTitle, setVolumeControlStream, show, takeCancelAndDismissListeners, takeKeyEvents, unregisterForContextMenu
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel, dismiss
onProvideKeyboardShortcuts
public static final int STYLE_SPINNER
public static final int STYLE_HORIZONTAL
public ProgressDialog(Context context)
public ProgressDialog(Context context, int theme)
public static ProgressDialog show(Context context, CharSequence title, CharSequence message)
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate)
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable)
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, DialogInterface.OnCancelListener cancelListener)
protected void onCreate(Bundle savedInstanceState)
Dialog
Activity.onCreate(android.os.Bundle)
, you should initialize your dialog
in this method, including calling Dialog.setContentView(int)
.onCreate
in class AlertDialog
savedInstanceState
- 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.public void onStart()
Dialog
protected void onStop()
Dialog
public void setProgress(int value)
public void setSecondaryProgress(int secondaryProgress)
public int getProgress()
public int getSecondaryProgress()
public int getMax()
public void setMax(int max)
public void incrementProgressBy(int diff)
public void incrementSecondaryProgressBy(int diff)
public void setProgressDrawable(Drawable d)
public void setIndeterminateDrawable(Drawable d)
public void setIndeterminate(boolean indeterminate)
public boolean isIndeterminate()
public void setMessage(CharSequence message)
setMessage
in class AlertDialog
public void setProgressStyle(int style)
public void setProgressNumberFormat(String format)
format
- A string passed to String.format()
;
use "%1d" for the current number and "%2d" for the maximum. If null,
nothing will be shown.public void setProgressPercentFormat(NumberFormat format)
NumberFormat.getPercentageInstnace().
Should not be called during the number is progressing.format
- An instance of a NumberFormat
to generate the
percentage text. If null, nothing will be shown.