I create a ProgressDialog
in onCreateDialog()
like so:
protected Dialog onCreateDialog(int id) {
if (id == DIALOG_PROGRESS_ID)
I don't like to removeDialog to recreate it on next showing. So, I resolve this issue by using onCreateDialog and onPrepareDialog:
1) In onCreateDialog I normally create the ProgressDialog. 2) In onPrepareDialog I reference the progressBar inside it and force to restart:
@Override
protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
switch (id){
.....
case DIALOG_PROGRESS_ID:
ProgressBar p = (ProgressBar) dialog.findViewById(android.R.id.progress);
p.setVisibility(View.GONE);
p.setVisibility(View.VISIBLE);
break;
}
}