I have implemented ontouchlistener
in my service class and trying to get the touch event which is working well with gingerbread
but it is not working with higher than icreamsandwich
. I am trying a lot to solve this but I am not getting any solution even after reading a lot of documents in stackoverflow,
Here is the code ..please help me solve this problem. In onCreate
method I have defined ImageButton
ImageButton imageButton=new ImageButton(this);
imageButton.setBackgroundColor(Color.TRANSPARENT);
imageButton.setOnTouchListener(this);
WindowManager.LayoutParams layoutParams=new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT);
WindowManager windowManager=(WindowManager)getSystemService(WINDOW_SERVICE);
windowManager.addView(imageButton, layoutParams);`
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
Toast.makeText(getApplicationContext(), "Double touched "+DoubleTouch, 1000).show();
return true;
}