Monday 15 June 2015

android - Multi touch problems with ID -


In the code below I am testing multi touch on my device. I have the problem with the action step, if I touch the screen with one finger, then I get the Touch input id in the logcat and when I touch the screen with the second finger and start moving it, I still have both fingers I get the ID, yet it is that the finger of the fingers' moves! I am confused and need some help to improve my code.

  @Override Public Boolean On-Touch (see V, Motion Event Event) {int pointerId; Int pointer index; Synchronize (gameLoop) {for (int i = 0; i & lt; event.getPointerCount () & i & lt; 2; i ++) {num = event.getPointerCount (); // id = event.getPointerId (i); // if down (event.get actionindx () == i & amp; amp; (event.getActionMasked () == MotionEvent.ACTION_POINTER_DOWN || event.getActionMasked () == MotionEvent.ACTION_DOWN)) {int j = event. GetPointerCount (); Int id = event.getPointerId (i); String numDown = integer.tastin (j); String cid = integer Trusting (id); Logs. I ("Test", "Number Below:" + + "Id:" + sId); } // Move if (event.get actionmoxed () == motion event.action_ MOVE) {int j = event.getPointerCount (); Int id = event.getPointerId (i); String numDown = integer.tastin (j); String cid = integer Trusting (id); Logs. I ("Test", "Moving:" + Downdown + "ID:" + sId); } // Up (Event.get ActionIndex () == i & amp; amp; (event.getActionMasked () == MotionEvent.ACTION_POINTER_UP || event.getActionMasked () == MotionEvent.ACTION_UP)) {int k = event .getPointerCount (); Int Children = event.getPointerId (i); String numup = integer.txtring (k); String SSID = integer .strusting (child); Logs. I ("Test", "Number UP:" + + "+" ID: "+ ssId"); }}} Be true; }    

  case motion event. Action_ MOVE: int j = event.getPointerCount (); Int finger1 = 0; Int fingerTwoDown = 0; {Int pointerIndex = i; for int i = 0; i & lt; j; ++ i) Id = event.getPointerId (index indicator); Log D. ("Indicator id - move", integer .stosting (id)); If (id == 0) {fingerOneDown = 1; Int fingerOneX = event.getX (PorterIndex); Int fingerOneY = event.getY (PorterIndex); Logs. E ("Finger Touch", "Touch ==" + FingOnx + "," + fingerline); } If (pointer id == 1) {fingerTwoDown = 1; Int fingerTwoX = event.getX (PorterIndex); Int fingerTwoY = event.getY (PorterIndex); Logs. E ("Finger Touch", "Touch ==" + Fingtoo X + "," + FingTUUI); } } break;    

No comments:

Post a Comment