2011-06-11 2 views
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 
    } 
} 
+2

logcat의 출력을 포함하는 것이 좋습니다. 예외를 캡처하고 질문을 편집 한 후 여기에 붙여 넣으십시오. – Femi

답변

3

getPointerCount()는 API 레벨 5. 만약부터 사용할 수있는 유형에 대해 정의되지 않는다 Android 2.0 이전의 SDK를 사용하면 그 오류.

관련 문제