2

I need to capture a long press, plus the coordinates of the event. It seems to me that a longer threshold or timeout for the long press action will fit better.

final GestureDetector gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {

    public void onLongPress(MotionEvent e) {
        //do something with coordinates
    }
});
this.fl_overlay.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        gestureDetector.onTouchEvent(event);
        return false;
    }
});

I see in source code of GestureDetector a

private static final int LONGPRESS_TIMEOUT =  ViewConfiguration.getLongPressTimeout();

Is there a way to extend this value?

pulancheck1988
  • 2,024
  • 3
  • 28
  • 46
  • Is it really that hard to create your own long press detector? Its about 5 lines of code. Its actually quicker to write than it is to look up whether that setting is changable. – Gabe Sechan Sep 27 '16 at 20:28

0 Answers0