public class

GestureDetector

extends Object
java.lang.Object
   ↳ com.neomades.gesture.GestureDetector

Class Overview

A GestureDetector is able to detect various gestures made on a view.

Gestures can be:

  • A tap which is a short touch press on the screen.
  • A double tap which occurs when two consecutive presses are made on the screen.
  • A long press gesture.
  • A pan gesture (or drag gesture) which represents a press and move on the screen.
  • A pinch gesture which occurs when two fingers press the screen at the same time and get closer (pinch-in) or move away (pinch-out).
  • A rotate gesture which is made by pressing the screen with two fingers at the same time and applying a rotation.

One can register a listener for the desired gesture by calling the corresponding setter.

A single GestureDetector may be set on different views. Use setGestureDetector(GestureDetector) to register the detector on the view.

Summary

Public Constructors
GestureDetector()
Creates a new gesture detector.
Public Methods
void setDoubleTapListener(DoubleTapListener listener)
Tells the GestureDetector to listen to double tap gesture.
void setLongPressListener(LongPressListener listener)
Tells the GestureDetector to listen to long press gesture.
void setPanListener(PanListener listener)
Tells the GestureDetector to listen to pan gesture.
void setPinchListener(PinchListener listener)
Tells the GestureDetector to pinch gesture.
void setRotateListener(RotateListener listener)
Tells the GestureDetector to listen to rotate gesture.
void setTapListener(TapListener listener)
Tells the GestureDetector to listen to tap gesture.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GestureDetector ()

Creates a new gesture detector.

Public Methods

public void setDoubleTapListener (DoubleTapListener listener)

Tells the GestureDetector to listen to double tap gesture. Set to null to remove a previously set listener.

Parameters
listener the listener for the double tap gesture (null to remove a previous listener)

public void setLongPressListener (LongPressListener listener)

Tells the GestureDetector to listen to long press gesture. Set to null to remove a previously set listener.

Parameters
listener the listener for the long press gesture (null to remove a previous listener)

public void setPanListener (PanListener listener)

Tells the GestureDetector to listen to pan gesture. Set to null to remove a previously set listener.

Parameters
listener the listener for the pan gesture (null to remove a previous listener)

public void setPinchListener (PinchListener listener)

Tells the GestureDetector to pinch gesture. Set to null to remove a previously set listener.

Parameters
listener the listener for the pinch gesture (null to remove a previous listener)

public void setRotateListener (RotateListener listener)

Tells the GestureDetector to listen to rotate gesture. Set to null to remove a previously set listener.

Parameters
listener the listener for the rotate gesture (null to remove a previous listener)

public void setTapListener (TapListener listener)

Tells the GestureDetector to listen to tap gesture. Set to null to remove a previously set listener.

Parameters
listener the listener for the tap gesture (null to remove a previous listener)