7.2.6. GestureDetector and SimpleOnGestureListener

This app uses a GestureDetector (package android.view) to hide or show the device’s system bars and the app’s action bar. A GestureDetector allows an app to react to user interactions such as flings, single taps, double taps, long presses and scrolls by implementing the methods of interfaces GestureDetector.OnGestureListener and GestureDetector.OnDoubleTapListener interfaces. Class GestureDetector.SimpleOnGestureListener is an adapter class that implements all the methods of these two interfaces, so you can extend this class and override just the method(s) you need from these interfaces. In Section 7.6, you’ll initialize a GestureDetector with a SimpleOnGestureListener, which will handle the ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.