5. User Interface Events

The two aspects of a user interface are screen layout and event handling. Chapter 4, “User Interface Layout,” discussed how layouts are made up of View objects, such as text and buttons. This chapter shows how to handle events from a user, such as physical key presses, touch events, and menu navigation. It also shows how to utilize a few advanced user interface (UI) libraries, namely gestures and 3D graphics.

Event Handlers and Event Listeners

Most user interaction with an Android device is captured by the system and sent to a corresponding callback method. For example, if the physical Back button is pressed, the onBackPressed() method is called. These events can be handled by extending the class and overriding the ...

Get The Android Developer’s Cookbook: Building Applications with the Android SDK 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.