About Android Progress Dialog. Avoid?

Hong Wei Wang picture Hong Wei Wang · Jan 16, 2014 · Viewed 10.7k times · Source

I was reading about Dialogs in Android site and I came across a section that saying "Avoid ProgressDialog".

Here is the link: http://developer.android.com/guide/topics/ui/dialogs.html

does that means they recommend not to use it? I really need a popup with showing progress while my app is doing background work.

Does that means I have to build my own Progress Dialog using ProgressBar class? How would one build it by the way? Any help is appreciated.

Answer

A--C picture A--C · Jan 16, 2014

Edit: With Android O, ProgressDialog is now officially deprecated. An alternative is approach is suggested

This class was deprecated in API level O. Use a progress indicator such as ProgressBar inline inside of an activity rather than using this modal dialog.


Original answer:

This is all from a design & user interaction perspective, not a code perspective.

The UI guidelines are telling you to avoid using a ProgressDialog not because the class is deprecated (it is not at the time of writing this answer), but rather because it forces the user to avoid interacting with the application and merely stare at the screen.

Take the Google Play app as an example. While it downloads an application/update, you can still swipe, navigate, etc. You can still be involved with the app while it is doing something.

If you absolutely need the user to cease interaction until the progress bar finishes, by all means do so. The docs are merely saying you may be able to find better ways of doing it (hence the link to Progress & Activity).