January 2014
Intermediate to advanced
736 pages
70h 43m
English
Method onTouchEvent (Fig. 7.28) is called when the View receives a touch event. Android supports multitouch—that is, having multiple fingers touching the screen. At any time, the user can touch the screen with more fingers or remove fingers from the screen. For this reason, each finger—known as a pointer—has a unique ID that identifies it across touch events. We’ll use that ID to locate the corresponding Path objects that represent each line currently being drawn. These Paths are stored in pathMap.
158 // handle touch event159 @Override160 public boolean onTouchEvent(MotionEvent event)161 {162 // get the event type and the ID of the pointer that caused the ...
Read now
Unlock full access