|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.GestureDetector
public class GestureDetector
Detects various gestures and events using the supplied MotionEvents.
The GestureDetector.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:
GestureDetector for your View
View.onTouchEvent(MotionEvent) method ensure you call
onTouchEvent(MotionEvent). The methods defined in your callback
will be executed when the events occur.
| Nested Class Summary | |
|---|---|
static interface |
GestureDetector.OnGestureListener
The listener that is used to notify when gestures occur. |
static class |
GestureDetector.SimpleOnGestureListener
A convenience class to extend when you only want to listen for a subset of all the gestures. |
| Constructor Summary | |
|---|---|
GestureDetector(GestureDetector.OnGestureListener listener)
Creates a GestureDetector with the supplied listener. |
|
GestureDetector(GestureDetector.OnGestureListener listener,
Handler handler)
Creates a GestureDetector with the supplied listener. |
|
| Method Summary | |
|---|---|
boolean |
isLongpressEnabled()
|
boolean |
onTouchEvent(MotionEvent ev)
Analyzes the given motion event and if applicable triggers the appropriate callbacks on the GestureDetector.OnGestureListener supplied. |
void |
setIsLongpressEnabled(boolean isLongpressEnabled)
Set whether longpress is enabled, if this is enabled when a user presses and holds down you get a longpress event and nothing further. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GestureDetector(GestureDetector.OnGestureListener listener,
Handler handler)
listener - the listener invoked for all the callbacks, this must
not be null.handler - the handler to use, this must
not be null.
NullPointerException - if either listener or
handler is null.public GestureDetector(GestureDetector.OnGestureListener listener)
listener - the listener invoked for all the callbacks, this must
not be null.
NullPointerException - if listener is null.Handler.Handler()| Method Detail |
|---|
public void setIsLongpressEnabled(boolean isLongpressEnabled)
isLongpressEnabled - whether longpress should be enabled.public boolean isLongpressEnabled()
public boolean onTouchEvent(MotionEvent ev)
GestureDetector.OnGestureListener supplied.
ev - The current motion event.
GestureDetector.OnGestureListener consumed the event,
else false.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||