Marcos Vasconcelos Marcos Vasconcelos - 1 year ago 188
Android Question

OnUp event on GestureDetector

My question is simple, where's the onUp event when implementing a GestureListener?

I has a lot of events on the gesturedetector, and cannot just consume the onUp event of the listener, cause one of events are the onSingleTapConfirmed that needs it.

Answer Source

Try using onFling(). Seems like a weird name but for me, it works as the onUp() method would logically work. Or try this method...

public boolean onTouchEvent(MotionEvent me) {

  Log.v("ADAM", "ontouch: " + me.getAction());

  if(me.getAction() == 0){
    Log.v("ADAM", "Down");
  else if (me.getAction() == 1) {
    Log.v("ADAM", "Up");
  else if (me.getAction() == 2) {
    Log.v("ADAM", "Scroll");
  boolean detectedUp = event.getAction() == MotionEvent.ACTION_UP;
  if (!mGestureDetector.onTouchEvent(event) && detectedUp) {
    return onUp(event);
  return true;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download