Search code examples
androidscreenandroid-asynctaskprogressdialogtap

How can I make a ProgressDialog be cancelable by the back button but not by a screen tap?


I would like to make a ProgressDialog cancelable by the back button but not by a screen tap. Currently I use setCancelable(true).

However, in some newer devices a tap on the screen also cancels the ProgressDialog. I'd like to disable the screen tap action while the ProgressDialog is shown.


Solution

  • Use setCanceledOnTouchOutside(false).