O'Reilly logo

Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets by Shawn Van Every

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

Finger Painting

Creating a static drawing on a Bitmap Canvas is all well and good, but let's take this a bit further and explore how we can make an application that allows the user to create a drawing.

Touch Events

To start this application, we'll need to understand how Android tells us when a user has touched the touchscreen. Being able to handle that, we can then allow the user create a drawing using his or her fingers on the touchscreen.

As we know, many of the UI elements that we use in Android derive from the View class. Since we have been working with the Canvas from a Bitmap that is displayed in an ImageView, it makes sense to see if that can help us out with detecting where the user touches.

As luck would have it, the View class is touch-capable. ...

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