Problem using ProgressDialog with onCreateDialog / onPrepareDialog

android, progressdialog

Solution

I just tried your sample and it seems changing from `ProgressDialog.STYLE_SPINNER` to `ProgressDialog.STYLE_HORIZONTAL` fixed the weird double-box problem.

And it also displays the title and text.

Edit:

You are passing `ProgressDialog.STYLE_SPINNER` in the `ProgressDialog` constructor.

From the doc, the 2nd argument is a theme id.

You will have to create a `ProgressDialog` object and use the `setProgressStyle` to `ProgressDialog.STYLE_SPINNER`

case DIALOG_LOOKUP:
     ProgressDialog pdlg = new ProgressDialog(this);
     pdlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
     return pdlg;

Problem

I'm using the following code to create a ProgressDialog (inside my Activity): ``` @Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_LOOKUP: return new ProgressDialog(this, ProgressDialog.STYLE_SPINNER); } return null; } @Override protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case DIALOG_LOOKUP: dialog.setCancelable(true); dialog.setTitle(R.string.dialogLookup_title); ((ProgressDialog)dialog).setMessage(getResources().getString(R.string.dialogLookup_message)); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { Toast.makeText(MyActivity.this, "canceled", Toast.LENGTH_SHORT).show(); } }); break; } } ``` The problem is that it isn't actually setting the title and is putting it in some weird double-box. It's giving me this: but I'm expecting something more like this: Any ideas?

Original source