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 single-tap event that hides or shows the system bars and action bar.