DoodleView Constructor

The constructor (Fig. 7.22) initializes several of the class’s instance variables—the two Maps are initialized in their declarations in Fig. 7.21. Line 49 creates the Paint object paintScreen that will be used to display the user’s drawing on the screen and line 52 creates the Paint object paintLine that specifies the settings for the line(s) the user is currently drawing. Lines 53–57 specify the settings for the paintLine object. We pass true to Paint’s setAntiAlias method to enable anti-aliasing which smooths the edges of the lines. Next, we set the Paint’s style to Paint.Style.STROKE with Paint’s setStyle method. The style can be STROKE, FILL or FILL_AND_STROKE for a line, a filled shape without a border and a filled ...

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.