Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Android prevent duplicate click
private long mLastClickTime = 0L;
.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) {
// mis-clicking prevention :: 1000 ms
if (SystemClock.elapsedRealtime() - mLastClickTime < 1000) return;
mLastClickTime = SystemClock.elapsedRealtime();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment