Skip to content

Instantly share code, notes, and snippets.

@deskid
Created January 10, 2016 15:15
Show Gist options
  • Save deskid/5d4f74827b82982e5c93 to your computer and use it in GitHub Desktop.
Save deskid/5d4f74827b82982e5c93 to your computer and use it in GitHub Desktop.
long[] mClicks = new long[n];
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
System.arraycopy(mClicks, 1, mClicks, 0, mClicks.length - 1);
mClicks[mClicks.length - 1] = SystemClock.uptimeMillis();
if(mClicks[0] >= (SystemClock.uptimeMillis() - 500)){
doSomething();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment