I am trying to implement a onTouchListener so i can call it from a different class...
public OnTouchListener nextListener = new OnTouchListener() {
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//stuff
}
return true;
}
};
And it keeps throwing me this error. "Class anonymous class derived from onTouchListener must either be abstract or implement abstract method". I know it is something small because I had it working earlier.
The default method is called onTouch not onTouchEvent
public View.OnTouchListener nextListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//stuff
}
return true;
}
};
From the android api

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With