Gesture recognition on mobile devices is not restricted to single pointer inputs such as the double-taps and flings we met earlier in this chapter, and functions such as pinch-zoom would be difficult to perform on a touch-screen with fewer than two fingers.
Again we will make use of a gesture detector and its listeners. In this case we will be using the ScaleGestureDetector and its OnScaleGestureListener, which provide measurements useful for pinch-zooming but are flexible enough to apply to any number of situations.
The structure behind detecting multi-touch gestures is the same as for the single pointed gestures we covered earlier in the chapter. Load up any project you wish and we will create the listener as an inner class that you can apply as you wish.