Thursday, 12 September 2013

Touch event doesn't contain getAxisValue method

Touch event doesn't contain getAxisValue method

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?

No comments:

Post a Comment