Window manager blocks my application

I want to capture touch events from my application but I want to capture the event and pass the event to my application.
So I created a layer using the window manager (width/height of parent) and I get the events but I can’t pass the events to the application. How can I capture the touch event and the delegate it to my application?

This is what I do and it captures the events but I can’t interact with my app (underneath)

mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_FULLSCREEN, PixelFormat.TRANSLUCENT);
mParams.gravity = Gravity.LEFT | Gravity.TOP;

public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_UP)
Log.i(“action = ” + event.getAction() + ” X :” + event.getRawX() + “Y :”+ event.getRawY());
return false;

Source: android

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.