Put the event handlers inside an extension of the SimpleOnGestureListener. Take a look at the last example here: https://developer.android.com/training/gestures/detector.html
In your code:
mDetector = new GestureDetectorCompat(this,new MyGestureListener());
Where you have MyGestureListener extend the SimpleOnGesture Listener:
class MyGestureListener extends GestureDetector.SimpleOnGestureListener {
private static final String DEBUG_TAG = "Gestures";
@Override
public boolean onDown(MotionEvent event) {
Log.d(DEBUG_TAG,"onDown: " + event.toString());
return true;
}
@Override
public boolean onFling(MotionEvent event1, MotionEvent event2,
float velocityX, float velocityY) {
Log.d(DEBUG_TAG, "onFling: " + event1.toString()+event2.toString());
return true;
}
}