android 双击事件(谷歌写法)

1
2
3
4
5
6
long[] mHits = new long[2];
System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
mHits[mHits.length - 1] = SystemClock.uptimeMillis();
if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
// Toast.makeText(this, "恭喜你,2次点击了。", 0).show();
}