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. ...

Get Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets 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.