I have written code for an application. It has some motion events. The motion event has got Down, Move and Up states. The event is bounded to a specific key until Up/Cancel happens.
But I want to cancel the motion event when Move happens, but not the entire application. How can I cancel the motion event?
Please give me some idea. Any helpful links/sample code is appreciated.
public boolean onTouch(View v, MotionEvent event) {
switch (v.getId()) {
case R.id.camera_surface:
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_MOVE:
}
}
return true;
}
Whatever Event you want to disable just don,t put any code in that case. and at the end return the true value.
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