Android双击三点...击事件

@bingoogolapple 2014-09-29 01:32:04发表于 bingoogolapple/bingoogolapple.github.io Android

  1. SystemClock.uptimeMillis() // 从开机到现在的毫秒数(手机睡眠的时间不包括在内);
  2. System.currentTimeMillis() // 从1970年1月1日 UTC到现在的毫秒数;
//全局变量
long[] mHits = new long[2];

//OnClickListener中
/*
public static void arraycopy (Object src, int srcPos, Object dst, int dstPos, int length)
Added in API level 1
Copies length elements from the array src, starting at offset srcPos, into the array dst, starting at offset dstPos.
The source and destination arrays can be the same array, in which case copying is performed as if the source elements are first copied into a temporary array and then into the destination array.
Parameters
src
the source array to copy the content.
srcPos
the starting index of the content in src.
dst
the destination array to copy the data into.
dstPos
the starting index for the copied content in dst.
length
the number of elements to be copied.
*/
// 数组中所有的值左移动一个位置
System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
// 最后一个位置的值为当前时间
mHits[mHits.length - 1] = SystemClock.uptimeMillis();
if (mHits[mHits.length - 1] - mHits[0] <= 500) {
    //mHits.length击事件.");
}