I have a button and OnTouchListener attached to it. How can I find if there was a movement (when the user clicks the button) inside or outside? Both event.getAction () and event.getActionMasked () return only 0, 1, or 2, which are ActionDown, ActionUp, ActionMove, respectively. There's a constant MotionEvent.ACTION_OUTSIDE, which is 4, but somehow I donβt get it, even if I drag the contact outside the button, I still get 2 from both methods. What is the problem?
UPD: I found a nice solution - just check the focused state in sight after ACTION_UP. If it is not focused, it means that the movement has occurred outside of the view.
Yury pogrebnyak
source share