March 2016
Intermediate to advanced
428 pages
9h 2m
English
Unlike the Event Listeners described in the previous recipe, gestures require a two-step process:
Step 1 begins when the user touches the screen, which fires the onTouchEvent() callback with the movement data sent in a MotionEvent object. Fortunately, Android makes Step 2, analyzing the data, easier with the GestureDetector class, which detects the following gestures:
onTouchEvent()onDown()onFling()onLongPress()onScroll()onShowPress()onDoubleTap()onDoubleTapEvent()onSingleTapConfirmed()This recipe will demonstrate using the GestureDetector.SimpleOnGestureListener to recognize the touch and double tap gestures.
Read now
Unlock full access