Making a custom dialog undismissable in android
Asked Answered
M

2

5

I have a custom dialog which have 2 progress bars and a button on it. I am showing this dialog in onPreExecute ()of an AsyncTask and dissmissng it onPostExecute() the problem is that when ever i touch screen during the operation the dialog dissmiss. I want it to only dismiss when cancel button on dialog is pressed or downloading files is complete.

Machinist answered 6/6, 2014 at 10:46 Comment(0)
M
29

You can use

dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);

reference

Melodize answered 6/6, 2014 at 10:47 Comment(0)
P
2

To nr4bt's answer: set it when you declaring your custom dialog in activity or etc

inActiveFragment = new InactiveDialogFragment();
inActiveFragment.setCancelable(false);
Ponder answered 6/6, 2014 at 10:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.