Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing a Dialog and still delivering clicks to the background?

Tags:

android

I want to show a small Custom Dialog on top of the current user activity, but have clicks to the area outside of my Dialog delivered to the background (which would be the launcher, or another activity). I tried to create a transparent base-activity and have the Dialog shown on top of it, but clicks are registered on the transparent activity and not on whatever is behind it...

I know that a Popup has a setOutsideTouchable-Method, but setting this to true just dismisses the popup, rather than delivering clicks to the background, to my knowledge...

Thanks for your help,
Nick

like image 675
Nick Avatar asked Oct 12 '22 14:10

Nick


2 Answers

Based on this clarification comment you posted on another answer...

"I want the Dialog to be shown system-wide, no matter which App the user is using at the moment..."

I don't believe what you want to do is possible and I'm happy about that. :) If you were allowed to popup a little dialog box over anyone else's app and still have the user be able to interact with the current activity... then you could easily trick the user into thinking that the little popup belonged to the current app and not yours which is acting from the background.

Imagine all of the evil you could do with something like that. Prompting for the user to reenter their email password when they are in the Email.app.. and then just storing it for malicious purposes, etc.

It isn't possible.. and SHOULDN'T be possible. If you need to notify the user of something, then you should use the built-in notification system. That's why it is there! :)

like image 136
Kenny Wyland Avatar answered Nov 15 '22 12:11

Kenny Wyland


You can use a PopupWindow "Dialog like" and show it for the user in top of your activity. The outside events will be delivered to the main Activity.

like image 42
Marcos Vasconcelos Avatar answered Nov 15 '22 12:11

Marcos Vasconcelos