View实现多次连续点击监听

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_31028313/article/details/81562016
mView.setOnClickListener(new View.OnClickListener() {
    long[] hints = new long[10];

    @Override
    public void onClick(View v) {
        //hints
        System.arraycopy(hints, 1, hints, 0, hints.length - 1);
        //获得当前系统已经启动的时间
        hints[hints.length - 1] = SystemClock.uptimeMillis();
        if (SystemClock.uptimeMillis() - hints[0] <= 3000) {
         //满足十次点击条件
        }
    }
});

猜你喜欢

转载自blog.csdn.net/qq_31028313/article/details/81562016