Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiTouchHandler Few Errors?
    text
    copied!<p>Getting a few errors and not sure what to do. Please help. Trying to develop snake game in android version 1.5 and using the eclipse sdk version 4.2.0 seem that these errors are the only thing holding me back from being able to debug my game.</p> <pre><code>The method getX() in the type MotionEvent is not applicable for the arguments (int) The method getY() in the type MotionEvent is not applicable for the arguments (int) The method getX() in the type MotionEvent is not applicable for the arguments (int) The method getY() in the type MotionEvent is not applicable for the arguments (int) The method getPointerCount() is undefined for the type MotionEvent The method getPointerId(int) is undefined for the type MotionEvent ACTION_POINTER_DOWN cannot be resolved or is not a field The method getX() in the type MotionEvent is not applicable for the arguments (int) The method getY() in the type MotionEvent is not applicable for the arguments (int) ACTION_POINTER_UP cannot be resolved or is not a field MultiTouchHandler.java ACTION_MASK cannot be resolved or is not a field ACTION_POINTER_ID_MASK cannot be resolved or is not a field ACTION_POINTER_ID_SHIFT cannot be resolved or is not a field The method getPointerId(int) is undefined for the type MotionEvent </code></pre> <p>The code:</p> <pre><code>public boolean onTouch(View v, MotionEvent event) { synchronized (this) { int action = event.getAction() &amp; MotionEvent.ACTION_MASK; int pointerIndex = (event.getAction() &amp; MotionEvent.ACTION_POINTER_ID_MASK) &gt;&gt; MotionEvent.ACTION_POINTER_ID_SHIFT; int pointerId = event.getPointerId(pointerIndex); switch (action) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_POINTER_DOWN: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_DOWN; touchEvent.pointer = pointerId; touchEvent.x = touchX[pointerId] = (int) (event .getX(pointerIndex) * scaleX); touchEvent.y = touchY[pointerId] = (int) (event .getY(pointerIndex) * scaleY); isTouched[pointerId] = true; touchEventsBuffer.add(touchEvent); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_CANCEL: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_UP; touchEvent.pointer = pointerId; touchEvent.x = touchX[pointerId] = (int) (event .getX(pointerIndex) * scaleX); touchEvent.y = touchY[pointerId] = (int) (event .getY(pointerIndex) * scaleY); isTouched[pointerId] = false; touchEventsBuffer.add(touchEvent); break; case MotionEvent.ACTION_MOVE: int pointerCount = event.getPointerCount(); for (int i = 0; i &lt; pointerCount; i++) { pointerIndex = i; pointerId = event.getPointerId(pointerIndex); touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_DRAGGED; touchEvent.pointer = pointerId; touchEvent.x = touchX[pointerId] = (int) (event .getX(pointerIndex) * scaleX); touchEvent.y = touchY[pointerId] = (int) (event .getY(pointerIndex) * scaleY); touchEventsBuffer.add(touchEvent); } break; } return true; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload