I have 5 tabs and I want to call a function on it’s longclick (onLongClick()).
The longclick is working but when I release the touch the click (onClick()) function is also called along with it.
Please anyone help me on this problem.
I have 5 tabs and I want to call a function on it’s longclick
Share
It happens. I also had the same problem while implementing OnItemClickListener and OnItemLongClickListener.
You can accomplish this with a vairable value:
this won’t stop onClick from being called on long click but will fulfill your purpose by not performing the task you want to perform only on onClick().
Another method is to call another activity using intent from method onLongClick(). This will stop onClick() from being called because the control will move to another activity.