I need the image button to be visible when the user opens another app, you know, i need it like the floating button that is visible to the user when the user opens any other app. i have a switch button the controls if the image button is visible or not
Asked
Active
Viewed 85 times
0
-
The image button is Now visible inside the app only, but i need it to be visible OUTSIDE the app too, "as long as the switch is on" – malaa Nov 12 '16 at 17:57
1 Answers
0
Have a look at this question.
Essentially you need to use the SYSTEM_ALERT_WINDOW permission which allows you to draw over other apps, make a custom layout file which contains the button that you want to show and use the WindowManager to insert it into the view.
-
great,but there is stil a Problem, when the switch is ON, the imageButton is visible.... but when i turn it off again, the imageButton doesnt disappear .. ....although I made an if conditional on the switch state so when its OFF->it executes-> manager.removeView(view); so the imageButton should be turned off but it doesnt! – malaa Nov 14 '16 at 12:06
-
You need to persist the inflated View object and pass the same object when you want to remove it. Like this : http://pastie.org/10962229 – rhari Nov 14 '16 at 17:29