views:

29

answers:

2

I have a gridview and i want its items to act different if user performs click or long click that is why i am using OnItemClickListener and OnItemLongClickListener but when long click happens both listeners react.I want to perform only OnItemLongClickListener.

A: 

You can use AdapterView.setOnItemLongClickListener. GridView inherits AdapterView, so you can invoke that method on GridView too.

Tony
I am using AdapterView.setOnItemLongClickListener already but i am using setOnItemClickListener too and they both react to the long clicks i want to prevent OnItemClickListener react to the long clicks.
Tony
Try KeyEvent.isLongPress()
Tony
A: 

In order to intercept long cliks (aka tapping) you should imlement GestureDetector.OnGestureListener

barmaley