Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

I have an activity that is using the Theme.Dialog style such that it is a floating window over another activity. However, when I click outside the dialog window (on the background activity), the dialog closes. How can I stop this behaviour?

1 Answer

0 votes
by (46k points)

This could assist you. It is a way to manage the touch outside event:

How to cancel a Dialog themed like Activity when touched outside the window?

By grabbing the event and doing nothing, I think you can prevent the closing. But what is strange though, is that particular default behavior of your project dialog should be not to close itself when you touch outside.

(PS: the code practices WindowManager.LayoutParams)

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...