문제

My application has a minimum API level set to 10 and the main activity extends SherlockActivity which is basically a regular activity. I wanted to use the touch event, so I used this code:

@Override
  public boolean onTouchEvent(MotionEvent event) {
    try
    {
      float x1 = event.getAxisValue(MotionEvent.AXIS_X);

However, an exception was thrown:

java.lang.NoSuchMethodError: android.view.MotionEvent.getAxisValue

According to this, getAxisValue was added at API level 1. Why can't I use it?

도움이 되었습니까?

해결책

getAxisValue (int axis) is added in api level 12.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top