3

I want to fire a method after a touch has been initiated and left the screen. I can detect the beginning of a touch by setting a OnTouch event to the View but can't detect when the hand leave the screen. I want to detect when does the touch stops. How can i detect this?

SysClaude
  • 146
  • 2
  • 8

3 Answers3

3

What you're looking for is http://developer.android.com/reference/android/view/MotionEvent.html - Specifically the use of MotionEvent.ACTION_UP. There is a lot of information on the link I've provided :)

A gesture starts with a motion event with ACTION_DOWN that provides the location of the first pointer down. As each additional pointer that goes down or up, the framework will generate a motion event with ACTION_POINTER_DOWN or ACTION_POINTER_UP accordingly. Pointer movements are described by motion events with ACTION_MOVE. Finally, a gesture end either when the final pointer goes up as represented by a motion event with ACTION_UP or when gesture is canceled with ACTION_CANCEL.

laminatefish
  • 5,197
  • 5
  • 38
  • 70
2

you can use MotionEvent.ACTION_UP to detect touch up.

nitesh goel
  • 6,338
  • 2
  • 29
  • 38
0

I would look at this answer. Basically it says that you need to return true to process anything other than ACTION_DOWN.

Community
  • 1
  • 1
Uxonith
  • 1,602
  • 1
  • 13
  • 16