Home » Android » android – I can't see the progress spinner in ProgressDialog on Lollipop

android – I can't see the progress spinner in ProgressDialog on Lollipop

Posted by: admin June 15, 2020 Leave a comment

Questions:

Making an app using ProgressDialog, and it shows up fine on JellyBean but when testing with Lollipop I only see the title and message, no progress spinner.. I am using

compile 'com.android.support:appcompat-v7:22.2.0'

Support library and AppCompatActivity

The code is:

 ProgressDialog progressDialog = new ProgressDialog(AddBuddyActivity.this);
 progressDialog.setMessage("Loading...");
 progressDialog.setCancelable(false);
 progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
 progressDialog.show();

You can see another question I posted on the same topic here.

How to&Answers:

NOTE: You can see a pseudo-duplicate of this question here. The one in the link is a little more thorough, but both have the same solution.

The answer seems to be that if a user has transitions turned off in developer options, your animations in a ProgressDialog (namely the Progress Spinner) will not show. Turn them on and restart the app and you will see the spinner!

A solution that would allow for animations with those settings turned off seems to be to make a custom dialog, which admittedly would probably look better than the default ProgressDialog.

And, as a fair warning to people attempting to abuse the ProgressDialog, heed these words from the developer documentation:

Android includes another dialog class called ProgressDialog that shows a dialog with a progress bar. However, if you need to indicate loading or indeterminate progress, you should instead follow the design guidelines for Progress & Activity and use a ProgressBar in your layout.

From this, I take that using them for long calls over the network are OK, while loading information or doing a long local process should be indicated using one of the other progress components.

Answer:

I am using this in Lollipop. Let me know if it works for you.
The support library I am using is android-support-v4.jar

import android.app.ProgressDialog;

ProgressDialog dialog = ProgressDialog.show(this, "Title", "Message ", true, true);//Put this where you need it

This is working fine for me on:
Droid Razor M with 4.4.2
Samsung Note 4 with 5.0.1
Samsung Galaxy 6 Edge with 5.1.1