Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 960
Brandon Avatar asked Sep 15 '15 23:09

Brandon


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

like image 193
Brandon Avatar answered Oct 07 '22 19:10

Brandon