LongClick event also triggers Click event LongClick event also triggers Click event android android

LongClick event also triggers Click event


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.


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;            }        });