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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.