5.12 Wrap-Up

In this chapter, you built the Doodlz app, which enables users to paint by dragging one or more fingers across the screen. You implemented a shake-to-erase feature by using Android’s SensorManager to register a SensorEventListener that responds to accelerometer events, and you learned that Android supports many other sensors.

You created subclasses of DialogFragment for displaying custom Views in AlertDialogs. You also overrode the Fragment lifecycle methods onAttach and onDetach, which are called when a Fragment is attached to or detached from a parent Activity, respectively.

We showed how to associate a Canvas with a Bitmap, then use the Canvas to draw into the Bitmap. We demonstrated how to handle multitouch events, so the app ...

Get Android How to Program, 3/e 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.