多击
2016-06-02 19:17
253 查看
package com.hello.duoji;import android.os.SystemClock;import android.support.v7.app.AlertDialog;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;public class MainActivity extends AppCompatActivity {long[] mHits = new long[2];@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}public void treeClick(View view) {/*** 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[0] >= (SystemClock.uptimeMillis() - 500)) { // 判断是否多击操作System.out.println("多击了...");AlertDialog.Builder builder =new AlertDialog.Builder(this);builder.setTitle("被双击拉~");}}}通过更改素质来更改次数
相关文章推荐
- Java面向对象编程之异常处理机制
- SecureCRT密钥远程登录Linux 【转】
- 面试:字符串:产生括号
- UIView Class Reference
- avalon.js 1.4.6简单列表数据绑定ms-repeat ms-click
- 用php输入表格内容
- java多态
- 第二阶段冲刺——个人总结06
- 代码段接收并遍历返回值为动态游标的方法
- 高并发数据结构Disruptor解析(1)
- codeforces 677c Vanya and Label
- listView、gidView和spinner
- php 指针遍历、预定义数组和常用函数
- Talking about paper
- 使用scala实现pageRank算法
- win10 64位下配置免安装版mysql 5. 6.30
- OC_判断字符串是否是纯数字
- 继承+重写+多态(用java写的例子)
- SQL SERVER全面优化-------Expert for SQL Server 诊断系列
- SpringMVC工作原理