package cn.com.basic.face.service; import android.os.SystemClock; public class PreventDoubleClick { private static long mLastClickTime = 0; private static int source = 0; public static boolean checkDoubleClick(int source) { if (source == PreventDoubleClick.source) { // mis-clicking prevention, using threshold of 1000 ms if (SystemClock.elapsedRealtime() - mLastClickTime < 1000){ return true; } } PreventDoubleClick.source = source; mLastClickTime = SystemClock.elapsedRealtime(); return false; } }