I am currently developing an app (on 4.4.2) which has to prevent the user from exit it. I've done some research and found out that MX Player does exactly what I want my app to do. While viewing a video it lets you click on a lock button which in turn prevents you from using home and back button. Also you can't pull down the status bar. You can open "recent apps" but open another app from there doesn't work either.
As I have understod, Mx Player draws itself on top of the outer UI. By doing that it will always be on top even if the home button is used. When launching another app you only launch it behind the app.
I have looked into this project:
It draws a ball which always will be on top. But how can I do the same with a layout? Is there some way of applying a layout to windowManager?
Edit: Found out that I can add the layout to windowManager by using:
LayoutInflater factory = LayoutInflater.from(this);
View myView = factory.inflate(R.layout.my_layout_id, null);
But how can I detect touches? Is there any better way of always displaying the application?
Thanks in advance!