Home > DeveloperSection > Forums > Long press Detection in andriod
ezra heywood
ezra heywood

Total Post:145

Posted on    April-25-2015 8:20 AM

 Android Android 

 1 Reply(s)
 604  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?

Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    April-25-2015 8:39 AM

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

Don't want to miss updates? Please click the below button!

Follow MindStick