How to stop receiving the x, y coordinates of motion events when finger leaves the current view in Android? -

i have set ontouchlistener on blue part of screen. obtain x,y coordinates when finger touched on it. white part not @ all. problem if @ beginning finger touched on blue part , when "moves out" white part, still continuing obtain x, y coordinates. ideally want device stop detecting motion event finger leaves screen. hope can help.
the easiest solution check if finger touching view comparing x,y coordinates views bounding rect. can stop receiving events returning false dispatchtouchevent then.
edit:
@override public boolean dispatchtouchevent(motionevent event) { rect outrect = new rect(); getdrawingrect(outrect); if (outrect.contains((int) event.getx(), (int) event.gety())) { return true; // want more events } else { return false; // stop events until next action_down on me } }
Comments
Post a Comment