google的多次点击实现
时间:2014-01-14 19:43:17
收藏:0
阅读:730
代码实现:
long[] mHits = new long[点击次数];//定义为成员变量
System.arraycopy(mHits, 1,
mHits, 0, mHits.length - 1); //相当于将数组向左平移1
mHits[mHits.length - 1] =
SystemClock.uptimeMillis();//SystemClock.uptimeMillis()手机开机时算起的毫秒值
if
(mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
//多次点击要实现的功能
}
System.arraycopy的文档描述
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. 目标数组(copy into)
- dstPos the starting index for the copied content
in
dst. 目标数组的起始位置 - length the number of elements to be copied. copy的个数
原文:http://www.cnblogs.com/ff0o0/p/3512729.html
评论(0)