The article is part of the content reference:
http://blog.csdn.net/barryhappy/article/details/7392326
Summarize:
1. event.getx () can get the coordinates of x , the parameter 0 inside indicates the first touch; 1 indicates a second touch point;
2. motionevent.action_down: Triggered when the first point is pressed
3. motionevent.action_up: triggers when the only point on the screen is released
4. If the index finger touches the screen first, it will trigger the action_down, then lift the action_up, and If the index finger touches the screen first, The middle finger then touches the screen, the middle finger triggers the action_pointer_2_down, andthen the lifted finger triggers action_pointer_2_up(in this case, Whether it is the index finger or the middle finger lifted up), and then, may press and lift again, the trigger is action_pointer_1_down and Action_pointer_1_down .
@SuppressWarnings ("Deprecation") Public Booleanontouchevent (Motionevent event) {intAction =event.getaction (); if(Event.getpointercount () = = 2) {x1= Event.getx (1); Y1= Event.gety (1); } x0= Event.getx (0); Y0= Event.gety (0); Switch(action) { CaseMotionEvent.ACTION_DOWN:HandleDown (Getarea (x0, y0)); Break; CaseMotionEvent.ACTION_UP:HandleUp (Getarea (x0, y0)); Break; //when you press two places, lift the 1th one and press again to trigger the Action_pointer_1_down CaseMotionEvent.ACTION_POINTER_1_DOWN:HandleDown (Getarea (x0, y0)); Break; CaseMotionEvent.ACTION_POINTER_1_UP:HandleUp (Getarea (x0, y0)); Break; CaseMotionEvent.ACTION_POINTER_2_DOWN:HandleDown (Getarea (x1, y1)); Break; CaseMotionEvent.ACTION_POINTER_2_UP:HandleUp (Getarea (x1, y1)); Break; } return Super. Ontouchevent (event); }