Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 298
benkdev Avatar asked Nov 11 '11 21:11

benkdev


People also ask

How do I make progress dialog not cancelable?

So how can I make it so that the Dialog is not cancelable? Android seems to be saying that ProgressDialog should not be used anymore, that instead you should “use a ProgressBar in your layout.” developer.android.com/guide/topics/ui/dialogs.html.

Why is ProgressDialog deprecated?

ProgressDialog 's look can be replicated by placing a ProgressBar into an AlertDialog . You can still use it, but Android does not want you to use it, that is why it is deprecated.


1 Answers

Use setCanceledOnTouchOutside(false).

like image 190
Kimi Avatar answered Oct 15 '22 19:10

Kimi