8. Handling Gestures
The basic Android UI toolkit provides the most common interaction gestures you will need in your application: taps, long presses, and swipes. But sometimes the built-in gestures aren’t sufficient for your application or are not available on the view you’re using. For those cases, Android provides the ability to create custom gestures. This chapter introduces the basics of detecting and responding to gestures. Along the way, you’ll learn that all views have an
onTouchEvent method you can use to intercept touch events; that the
MotionEvent class is the low-level interface to the touchscreen inputs; that you should use
GestureDetector and its subclasses to enable the most common gestures; and that you can enable pinch-to-zoom ...