I have a view that's always on the screen (over other apps), I wan't to receive touch events and than to pass them farther.
The code from the running Service
:
WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT);
v.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Toast.makeText(getApplicationContext(), "view touched", Toast.LENGTH_SHORT).show();
return false;
}
});
WindowManager localWindowManager = (WindowManager)getSystemService("window");
localWindowManager.addView(v, localLayoutParams);
currently I don't get the touches.
currently I'm trying to overcome the issue of passing the event to the views under mine (that aren't mine). As I understood from your answer I cannot do this. so I'm trying to find a way to simulate a touch event to the system – RCB Sep 16 '14 at 12:24