2
getPointerCount()
, getX()
및 getY()
에이 오류를 해결할 수있는 사람이 있습니까? 이 라인에서Android 게임에서 onTouchEvent에 발생하는 오류
여러 마커는
는 방법
getPointerCount()
은MotionEvent
코드
int pointerIndex;
public boolean onTouchEvent(MotionEvent event)
{
float xPosition1 = 0;
float yPosition1 = 0;
float xPosition2 = 0;
float yPosition2 = 0;
for (pointerIndex = 0; pointerIndex < event.getPointerCount(); pointerIndex++) //Error
{
if (pointerIndex == 0)
{
xPosition1 = event.getX(pointerIndex);// Error
yPosition1 = event.getY(pointerIndex);//Error
}
if (pointerIndex == 1)
{
xPosition2 = event.getX(pointerIndex);//Error
yPosition2 = event.getX(pointerIndex);//Error
}
}
logcat의 출력을 포함하는 것이 좋습니다. 예외를 캡처하고 질문을 편집 한 후 여기에 붙여 넣으십시오. – Femi