I have one View for which both onClickListener and onLongClickListener implemented. When I long click the view onClickListener triggers also, I don't need it to be executed when I do long click. Any ways to prevent it from being executed at time of long click?
return true; from the long click callback to signal that you've handled the event
Return true instead of false from onItemLongClick.
Reason: Return true if the callback consumed the long click, false otherwise.
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view,
int position, long id) {
// TODO Auto-generated method stub
/******
Change Here true instead of false.
*******/
return true;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With