1

I am currently coding a new android Application, and I need to use both OnItemClickListener and OnItemLongClickListener on a listview. Each listener launch a different actionmode on the actionbar. The problem is that the actionmode associated with the click event is the only that is launched even if I perform a longclick. After some research, I understand now why : a long click event also create click event, and I guess that this last event is always perform after the long click event, so that explain why I can't manage to display the other actionmode.

The question is : how can I block the click event when i do a longclick ? Or does it exist another mean to perform what I want to do ?

keyser
  • 18,829
  • 16
  • 59
  • 101
sam
  • 3,441
  • 2
  • 33
  • 42

1 Answers1

5

onLongClick():

Returns

true if the callback consumed the long click, false otherwise.

So, if you return true the onclick won't be executed.

keyser
  • 18,829
  • 16
  • 59
  • 101
  • It was this simple ?? thank you very much !! I search on the net for 1h but i guess i didn't put the right words ^^ – sam Oct 27 '12 at 23:24