Skip to content Skip to sidebar Skip to footer

Android: Progressdialog Failing

I'm having real problems getting a ProgressDialog up and running. My code: ProgressDialog dialog; try { dialog = new ProgressDialog(context); dialog.setCancelable(true); dia

Solution 1:

What kind of context are you using to create the ProgressDialog?

I think that the ProgressDialog want work with a ApplicationContext. The API is not very correct the constructor should request an Activity instead of a Context.

Try to pass a reference to a Activity to the constructor instead of an regular Context.

Instead of using:

Contextcontext= getApplicationContext();

use

Contextcontext=this;

Or if you are in an inner class of your Activity (a listener, or Task) use:

Contextcontext= MyActivityNameComesHere.this;

See my Issue in the Android Bugtracker about this.

Post a Comment for "Android: Progressdialog Failing"