getAxisValue (int axis)
is added in api level 12.
Touch event doesn't contain getAxisValue method
-
28-06-2022 - |
Question
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?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow