I have an Dialog (not an AlertDialog) which should only be dismissed when user press a button. But in my case, the dialog dismiss also when user press beside the dialog. How can i avoid that. Thnx for help!
Asked
Active
Viewed 61 times
3 Answers
0
setCanceledOnTouchOutside(boolean cancel) or setCancelable(boolean flag)
These are the methods that you can use to prevent Dialog from being dismissed

Digvesh
- 9
- 2
0
Set the cancelable state to false using this: '.setCalcelable(false)'
So your dialog code would look something like this...
Dialog mDialog = new Dialog(this); mDialog.setCancelable(false);

Pkmmte
- 2,822
- 1
- 31
- 41