Android: Progress Dialog spinner not spinning

Martin picture Martin · Jun 25, 2010 · Viewed 20k times · Source

This seems to be an Android-wide problem, which you can see in API demos under Views -> Progress Bar -> Dialogs.

Basically, if you show a progress dialog, it works as expected the first time around. If you dismiss it and show it again (without destroying the activity or anything like that), the spinning image stops spinning. In the API Demo you can see this by clicking "Show Indeterminate", pressing back to dismiss the dialog, and clicking the button again.

I've tried constructing my own progress dialog, however it shows the same problem, as the problem is with the "ProgressBar" spinning image.

I am wondering if anyone has a workaround for this problem.

Answer

ognian picture ognian · Jun 25, 2010

If you dismiss a Dialog, you must not show the same instance again. Either create a new one, or use hide() instead of dismiss(). When using hide() you still have to dismiss() it when no longer needed.