8

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.

Community
  • 1
  • 1
Brandon
  • 1,886
  • 2
  • 17
  • 28
  • add the code for you progress dialog to look – Tasos Sep 15 '15 at 23:51
  • Can you add your theme for this activity which is used in manifest? – Shishram Oct 05 '15 at 05:58
  • @Shishram, the theme is Theme.AppCompat.Light.DarkActionBar for all my themes – Brandon Oct 05 '15 at 19:46
  • 3
    So I realized that one issue I was having was I had animations turned off in developer options. Other apps on my phone started to not show a progress spinner in the ProgressDialog so I tinkered and discovered that was the issue for my app and theirs. However there are some apps (Discover, Fidelity, etc.) that still have spinners show when the animations are off. Do you think that these apps use a custom dialog? – Brandon Oct 05 '15 at 20:02
  • @Brandon Yup, your window animation scale being off was causing this issue. and to enable it programmatically you can have a look here http://stackoverflow.com/questions/27011200/how-to-enable-transition-animation-scale-in-developer-options-programmatical. and other app like(Discover,etc) are might be using custom dialogs. – Shishram Oct 06 '15 at 11:59
  • @Shishram, thanks for your confirmation of my discovery. Also, thanks for that link. I don't think I'll go through the trouble of programmatically turning on animations, as I want to respect any user's choice to turn them off. Down the road, I may decide to make a custom dialog. – Brandon Oct 06 '15 at 13:08
  • [other answer.Check your styles.xml](https://stackoverflow.com/questions/32939542/no-progress-spinner-in-progressdialog/49589663#49589663) – capslo Mar 31 '18 at 16:01
  • Check your styles.xml probaly you use white color. [other answer](https://stackoverflow.com/questions/32939542/no-progress-spinner-in-progressdialog/49589663#49589663) – capslo Mar 31 '18 at 16:03

2 Answers2

18

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.

Community
  • 1
  • 1
Brandon
  • 1,886
  • 2
  • 17
  • 28
  • 2
    Its true, tampering with developer option may hide ProgressBar. I turned developer options and progressdialog became visible. – codename_47 Jun 14 '17 at 06:17
  • Apparently, even a custom ProgressLoader will stop working after these settings are on. Hideous! – jujka Jun 13 '19 at 08:44
2

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

TerNovi
  • 390
  • 5
  • 16