January 2014
Intermediate to advanced
736 pages
70h 43m
English
The touchMoved method (Fig. 7.30) is called when the user moves one or more fingers across the screen. The system MotionEvent passed from onTouchEvent contains touch information for multiple moves on the screen if they occur at the same time. MotionEvent method getPointerCount (line 222) returns the number of touches this MotionEvent describes. For each, we store the finger’s ID (line 225) in pointerID, and store the finger’s corresponding index in this MotionEvent (line 226) in pointerIndex. Then we check whether there’s a corresponding Path in the pathMap HashMap (line 229). If so, we use MotionEvent’s getX and getY methods to get the last coordinates for this drag event for the specified pointerIndex
Read now
Unlock full access