Android Programming Press on the image to return to the main documentation page.

GestureDetector

Written by Fr\u00e9d\u00e9ric Leneuf-Magaud

List of types:

GestureDetector

GestureDetector


Events:

onTouch(Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
onPointerDown(ptrIndex As Int, PID As Int, MotionEvent As Object)
onPointerUp(ptrIndex As Int, PID As Int, MotionEvent As Object)
onDown(X As Float, Y As Float, MotionEvent As Object)
onSingleTapUp(X As Float, Y As Float, MotionEvent As Object)
onSingleTapConfirmed(X As Float, Y As Float, MotionEvent As Object)
onDoubleTap(X As Float, Y As Float, MotionEvent As Object)
onShowPress(X As Float, Y As Float, MotionEvent As Object)
onLongPress(X As Float, Y As Float, MotionEvent As Object)
onScroll(distanceX As Float, distanceY As Float, MotionEvent1 As Object, MotionEvent2 As Object)
onFling(velocityX As Float, velocityY As Float, MotionEvent1 As Object, MotionEvent2 As Object)

Members:


  ACTION_CANCEL As Int

  ACTION_DOWN As Int

  ACTION_MOVE As Int

  ACTION_UP As Int

  EnableLongPress (Enabled As Boolean)

  getAction (ev As android.view.MotionEvent) As Int

  getPID (ev As android.view.MotionEvent, ptrIndex As Int) As Int

  getPointerCount (ev As android.view.MotionEvent) As Int

  getPointerIndex (ev As android.view.MotionEvent, PID As Int) As Int

  getPressure (ev As android.view.MotionEvent, ptrIndex As Int) As Float

  getSize (ev As android.view.MotionEvent, ptrIndex As Int) As Float

  getX (ev As android.view.MotionEvent, ptrIndex As Int) As Float

  getY (ev As android.view.MotionEvent, ptrIndex As Int) As Float

  SetOnGestureListener (view As android.view.View, eventPrefix As String)

Members description:

ACTION_CANCEL As Int
ACTION_DOWN As Int
ACTION_MOVE As Int
ACTION_UP As Int
EnableLongPress (Enabled As Boolean)
Sets whether longpress is enabled. If this is enabled, when a user presses and holds down, you get a longpress event and nothing further. If it's disabled, the user can press and hold down and then later move their finger and you will get scroll events. By default longpress is enabled.
getAction (ev As android.view.MotionEvent) As Int
Returns the Action value from the given MotionEvent.
getPID (ev As android.view.MotionEvent, ptrIndex As Int) As Int
Returns the PID for the given pointer index.
0 is the first pointer index.
getPointerCount (ev As android.view.MotionEvent) As Int
Returns the number of pointers contained in the given event.
getPointerIndex (ev As android.view.MotionEvent, PID As Int) As Int
Returns the pointer index for the given PID
The PID (Pointer ID) is the pointer unique identifier sent back by the onPointerUp/Down functions.
getPressure (ev As android.view.MotionEvent, ptrIndex As Int) As Float
Returns the Pressure value from the given MotionEvent.
Set ptrIndex to 0 for the first pointer, to 1 for the second pointer, and so on.
getSize (ev As android.view.MotionEvent, ptrIndex As Int) As Float
Returns the Size value from the given MotionEvent.
Set ptrIndex to 0 for the first pointer, to 1 for the second pointer, and so on.
getX (ev As android.view.MotionEvent, ptrIndex As Int) As Float
Returns the X value from the given MotionEvent.
Set ptrIndex to 0 for the first pointer, to 1 for the second pointer, and so on.
getY (ev As android.view.MotionEvent, ptrIndex As Int) As Float
Returns the Y value from the given MotionEvent.
Set ptrIndex to 0 for the first pointer, to 1 for the second pointer, and so on.
SetOnGestureListener (view As android.view.View, eventPrefix As String)
Sets the listeners for the following events:
onTouch: notified whenever a MotionEvent occurs.
Handler: Sub MyView_onTouch(Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
onPointerDown: notified when a non-primary pointer has gone down.
Handler: Sub MyView_onPointerDown(ptrIndex As Int, PID As Int, MotionEvent As Object)
onPointerUp: notified when a non-primary pointer has gone up.
Handler: Sub MyView_onPointerUp(ptrIndex As Int, PID As Int, MotionEvent As Object)
onDown: notified when a tap occurs with the down MotionEvent that triggered it. This will be triggered immediately for every down event. All other events should be preceded by this.
Handler: Sub MyView_onDown(X As Float, Y As Float, MotionEvent As Object)
onSingleTapUp: notified when a tap occurs with the up MotionEvent that triggered it.
Handler: Sub MyView_onSingleTapUp(X As Float, Y As Float, MotionEvent As Object)
onSingleTapConfirmed: notified when a single-tap occurs. Unlike onSingleTapUp, this will only be called after the detector is confident that the user's first tap is not followed by a second tap leading to a double-tap gesture.
Handler: Sub MyView_onSingleTapConfirmed(X As Float, Y As Float, MotionEvent As Object)
onDoubleTap: notified when a double-tap occurs.
Handler: Sub MyView_onDoubleTap(X As Float, Y As Float, MotionEvent As Object)
onShowPress: the user has performed a down MotionEvent and not performed a move or up yet. This event is commonly used to provide visual feedback to the user to let them know that their action has been recognized i.e. highlight an element.
Handler: Sub MyView_onShowPress(X As Float, Y As Float, MotionEvent As Object)
onLongPress: notified when a long press occurs with the initial on down MotionEvent that triggered it.
Handler: Sub MyView_onLongPress(X As Float, Y As Float, MotionEvent As Object)
onScroll: notified when a scroll occurs with the initial on down MotionEvent and the current move MotionEvent. The distance in x and y is also supplied.
Handler: Sub MyView_onScroll(distanceX As Float, distanceY As Float, MotionEvent1 As Object, MotionEvent2 As Object)
onFling: notified when a fling occurs with the initial on down MotionEvent and the matching up MotionEvent. The calculated velocity is supplied along the x and y axis in pixels per second.
Handler: Sub MyView_onFling(velocityX As Float, velocityY As Float, MotionEvent1 As Object, MotionEvent2 As Object)
Top