O'Reilly logo

The Android™ Developer’s Cookbook: Building Applications with the Android SDK, Second Edition by Nelson To, Ronan Schwarz, James Steele, Phil Dutson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6. User Interface Events

The two aspects of a UI are screen layout and event handling. Chapter 5, “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 use a few advanced user interface 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 key is pressed, the onBackPressed() method is called. Such events can be handled by extending the class and overriding the methods, called event handlers. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required