2

I have imported the libraries, there are no errors or warnings but I can't get it working.

This is my ProgressDialog code:

pDialog = new ProgressDialog(MyActivity.this);
pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pDialog.setMessage("Message");
pDialog.setCancelable(false);
pDialog.show();

What I've tried:

  • I tried to change my App theme in the Manifest to: @android:style/Theme.Holo.Light and didn't work
  • I also tried to create the ProgressDialog instance like this: new ProgressDialog(Activity.this, R.drawable.dialog_full_holo_light);
  • I'm extending org.holoeverywhere.app.Activity; and importing org.holoeverywhere.app.ProgressDialog;

I don't know what I'm missing or why it isn't working. Can you please help me?

4 Answers4

5
ProgressDialog progressDialog;

if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB){
   progressDialog = new ProgressDialog(new ContextThemeWrapper(context, android.R.style.Theme_Holo_Light_Dialog));
}else{
   progressDialog = new ProgressDialog(context);
}

progressDialog.setMessage("Loading....");
progressDialog.show();
JeffMeJones
  • 354
  • 4
  • 5
2

Its working for me with this code:

ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setIndeterminate(true);
progressDialog.setMessage(message);
progressDialog.show();

Make sure your activity extends org.holoeverywhere.app.Activity; and that your not passing application context to the progresdialog constructor.

Note: I'm not importing holoeverywhere progressdialog but android.app.ProgressDialog;

nicous
  • 411
  • 2
  • 5
  • `and that your not passing application context to the progresdialog constructor` this helped me a lot. Thanks! – Eng.Fouad Aug 03 '13 at 09:03
2

It also works like this for me.

pDialog = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);

You can see the different layouts you may wanna see on a progress dialog in here. It inherits those styles from alert dialog.

http://developer.android.com/reference/android/app/ProgressDialog.html

Kostas Drak
  • 3,222
  • 6
  • 28
  • 60
1

I haven't had a change to use HoloEverywhere but it requires ActionBarSherlock so could try changing the style to Theme.Sherlock.Light or use it as a base. Something like:

<style name="AppTheme" parent="Theme.Sherlock.Light">
</style>

If that doesn't work just double check that you are using the org.holoeverywhere.app.***Activity imports.

Corey Scott
  • 2,430
  • 3
  • 28
  • 33