Long press Detection in andriod

Total Post:145

 1282  View(s)
Rate this:
I am currently using
onTouchEvent(MotionEvent event){

to detect when the user presses my glSurfaceView is there a way to detect when a long click is made. I'm guessing if I can't find much in the dev docs then it will be some sort of work around method. Something like registering ACTION_DOWN and seeing how long it is before ACTION_UP.

How do you detect long presses on android using opengl-es?
  1. Post:397

    Re: Long press Detection in andriod

    final GestureDetector gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
        public void onLongPress(MotionEvent e) {
            Log.e("", "Longpress detected");
    public boolean onTouchEvent(MotionEvent event) {
        return gestureDetector.onTouchEvent(event);

      Modified On Apr-27-2015 04:15:11 AM