I am trying to make long and normal onItemClickListener for my ListView. This code works but when I call the Long-click and removing my finger after the longClickListener was triggered onItemClickListener triggers too. What I'm doing wrong?
listView.setOnItemClickListener(new SubjectOnItemClick(listAdapter, getSherlockActivity()));
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
new ColorPickerDialog(
getSherlockActivity(),
listAdapter,
position
);
return false;
}
});
Simpy,return true instead of return false in your onItemLongClick.
Returning true means telling Android you already got what you want, and need nothing more. Hence, the code will stop. (not triggering onClick)
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