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

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