Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About Android Progress Dialog. Avoid?

Tags:

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.

like image 760
Hong Wei Wang Avatar asked Jan 16 '14 03:01

Hong Wei Wang


People also ask

How do I turn off progress dialog?

getText(R. string. msg_dlg_analyse_pic), true, //indeterminate true, new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { m_bRunning = false; } });

What can I use instead of progress dialog?

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.

Why is progress dialog deprecated?

ProgressDialog 's look can be replicated by placing a ProgressBar into an AlertDialog . You can still use it, but Android does not want you to use it, that is why it is deprecated.

How do I stop progress bar?

You want to stop the progressDialog or change its UI not to be circular? You can set your progressbar's visibility to invisible or gone through progressbar. setVisibility(View. INVISIBLE); or progressBar.


1 Answers

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

like image 122
A--C Avatar answered Oct 13 '22 13:10

A--C