GestureDetector
public
class
GestureDetector
extends Object
| java.lang.Object | |
| ↳ | android.view.GestureDetector |
Detects various gestures and events using the supplied MotionEvents.
The OnGestureListener callback will notify users when a particular
motion event has occurred. This class should only be used with MotionEvents
reported via touch (don't use for trackball events).
To use this class:
- Create an instance of the
GestureDetectorfor yourView - In the
View.onTouchEvent(MotionEvent)method ensure you callonTouchEvent(MotionEvent). The methods defined in your callback will be executed when the events occur. - If listening for
OnContextClickListener.onContextClick(MotionEvent)you must callonGenericMotionEvent(MotionEvent)inView.onGenericMotionEvent(MotionEvent).
Summary
Nested classes | |
|---|---|
interface |
GestureDetector.OnContextClickListener
The listener that is used to notify when a context click occurs. |
interface |
GestureDetector.OnDoubleTapListener
The listener that is used to notify when a double-tap or a confirmed single-tap occur. |
interface |
GestureDetector.OnGestureListener
The listener that is used to notify when gestures occur. |
class |
GestureDetector.SimpleOnGestureListener
A convenience class to extend when you only want to listen for a subset of all the gestures. |
Public constructors | |
|---|---|
GestureDetector(Context context, GestureDetector.OnGestureListener listener)
Creates a GestureDetector with the supplied listener. |
|
GestureDetector(Context context, GestureDetector.OnGestureListener listener, Handler handler)
Creates a GestureDetector with the supplied listener that runs deferred events on the
thread associated with the supplied |
|
GestureDetector(Context context, GestureDetector.OnGestureListener listener, Handler handler, boolean unused)
Creates a GestureDetector with the supplied listener that runs deferred events on the
thread associated with the supplied |
|
GestureDetector(GestureDetector.OnGestureListener listener)
This constructor is deprecated.
Use |
|
GestureDetector(GestureDetector.OnGestureListener listener, Handler handler)
This constructor is deprecated.
Use |
|
Public methods | |
|---|---|
boolean
|
isLongpressEnabled()
|
boolean
|
onGenericMotionEvent( |