Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Touch events provide a very low-level interface to the touchscreen that can be difficult to interpret. Often what you really need is the ability to recognize certain gestures the user makes on the screen. For that, Android provides convenience classes that detect gestures for you.
To detect gestures, you create an instance of the GestureDetector class and send it all touch events your view receives. You register an OnGestureListener with the GestureDetector to receive callbacks when gestures are detected. This interface has callbacks for the most common gestures you will need: taps, double taps, swipes, and flings.
Modify the example to zoom the text when you double-tap the screen:
1. Add a scale field to the View. You will use this to scale the text size: