DoodleView Methods clear, setDrawingColor, getDrawingColor, setLineWidth and getLineWidth

Figure 7.24 defines methods clear (lines 75–81), setDrawingColor (lines 84–87), getDrawingColor (lines 90–93), setLineWidth (lines 96–99) and getLineWidth (lines 102–105), which are called from the DoodleFragment. Method clear, which we use in the EraseImageDialogFragment, empties the pathMap and previousPointMap, erases the Bitmap by setting all of its pixels to white, then calls the inherited View method invalidate to indicate that the View needs to be redrawn. Then, the system automatically determines when the View’s onDraw method should be called. Method setDrawingColor changes the current drawing color by setting the color of the Paint object paintLine ...

Get Android™ How to Program, Second Edition 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.