Why my OnLongClickListener is not working?


Ask by : Luis A. Florit November 04, 2012 13:57

I want to show the EXIF of a picture when I perform a long click over it. So I implemented this:

    picture.setOnLongClickListener(new OnLongClickListener() { 
        public boolean onLongClick(View v) {
            ...
            return true;
        }
    });

Problem is that the code is not executed. I added android:longClickable="true" into the xml, without success.

Funny thing is that it works for OnClick, but it doesn't for OnLongClick... Maybe it has to do with the fact that my picture is and extension of ImageView, the (very nice!) class TouchImageView here:

https://github.com/MikeOrtiz/TouchImageView/blob/master/src/com/example/touch/TouchImageView.java

What am I doing wrong??

Thanks!!

View original question

Answer by : vasartNovember 04, 2012 13:57

TouchImageView in OnTouchListener always calls return true; (line 112 in file). That's why OnLongClickListener is not working.

View original answer