I have an application with a progress dialog (created by pd = new ProgressDialog(ActivityName.this); ... pd.show();) Everything works just fine but if I click/tap around the dialog, it is closed and the activity content gets to front of the view (the process handled by the dialog keeps running as expected - and the dialog reappears if I change screen orientation).
Is there any way to keep the dialog on top (i.e. disable taps outside the dialog)?
Note: in the emulator, the clicks are disabled as expected, on a real phone (SGII, A4.0.4), tapping on the progress dialog's surroundings closes the dialog...
Code:
mProgressDialog = new ProgressDialog(DownloaderActivity.this);
mProgressDialog.setMessage(DownloaderActivity.this.getString(R.string.downloadingfile));
mProgressDialog.setIndeterminate(false);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.show(); … mProgressDialog.dismiss();
Set the setCanceledOnTouchOutside() method to false. Take a look at the android API
If you have done that and it's still not working, it's probably a bug with the android system. One way to get around this have an onCancelListener so that when the dialog is cancelled, the code in the listener checks to see if the progress is done. If not, it could relaunch the Dialog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With