Understanding MotionEvents

In this section, we’re going to cover how Android tells applications about touch events from the user. For now, we will only be concerned with touching the screen one finger at a time (we’ll cover multitouch in a later section).

At the hardware level, a touch screen is made up of special materials that can pick up pressure and convert that to screen coordinates. The information about the touch is turned into data, and that data is passed to the software to deal with it.

The MotionEvent Object

When a user touches the touch screen of an Android device, a MotionEvent object is created. The MotionEvent contains information about where and when the touch took place, as well as other details of the touch event. The MotionEvent ...

Get Pro Android 4 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.