I use onLongClick and onClick events of a button to get user inputs. Whenever; the user long click and triggers onLongClick event, the onClick event is also triggered. I couldn\
here is a brief summary regarding touch event: http://rxwen.blogspot.com/2010/10/android-touch-event-summary.html
Solution On LongClick SingleClick will not work :
rippleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Your code
}
});
rippleView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
I'm not sure what order these events occur but the onLongClick handler returns a bool to indicate whether the event was handled. You should return true if you handled it so that other click events will not be called. I don't know if this will prevent prevent the onClick() from firing though.
You may also turn these events off and on using setClickable(boolean) and setLongClickable(boolean)
You can find this information and more about UI events here.