touchEnded Method of Class DoodleView
The touchEnded
method (Fig. 7.31) is called when the user lifts a finger from the screen. The method receives the ID of the finger (lineID
) for which the touch just ended as an argument. Line 262 gets the corresponding Path
. Line 263 calls the bitmapCanvas
’s drawPath
method to draw the Path
on the Bitmap
object named bitmap
before we call Path
’s reset
method to clear the Path
. Resetting the Path
does not erase its corresponding painted line from the screen, because those lines have already been drawn to the bitmap
that’s displayed to the screen. The lines that are currently being drawn by the user are displayed on top of that bitmap
.
259 // called when the user finishes ...
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.