The problem about ClickListener and LongClickListener


#1

Here is my problem. After I finished the challenge 3, I go to my SAMSUNG S5 to test. When I long clicked the ImageView, it goes into action mode(which is expected) AND popped the ImageFragment(which should not be) at the same time. I thought that it is, maybe, I triggered both the ClickListener and LongClickListener when I long clicked the ImageView. Is that a fact? What should I do to avoid the ClickListener when I performing the long-click action?
Thanks!


#2

Did you have your onLongClick method return true? You need to do that so the OnLongClickListener will consume the click and stop further processing.


#3

Thank you so much! @knutsondc
I just forgot this critical return value :astonished: