is View Fast Double Click - Android User Interface

Android examples for User Interface:View Click

Description

is View Fast Double Click

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static long lastClickTime = 0;
    public static View view;

    public static boolean isFastDoubleClick(View _view) {
        long time = System.currentTimeMillis();
        long timeD = time - lastClickTime;
        lastClickTime = time;/* w w w  . j  av  a 2 s .c o m*/
        if (view != null) {
            if (view.equals(_view)) {
                if (0 < timeD && timeD < 800) {
                    return true;
                }
            } else {
                view = _view;
                return false;
            }
        } else {
            view = _view;
            return false;
        }
        return false;
    }
}

Related Tutorials