public class ButtonUtils { private static long lastClickTime; public synchronized static boolean isFastClick() { long time = System.currentTimeMillis(); if (time - lastClickTime < 500) { return true; } lastClickTime = time; return false; } }
使用的时候:
public class ButtonUtils { private static long lastClickTime; public synchronized static boolean isFastClick() { long time = System.currentTimeMillis(); if (time - lastClickTime < 500) { return true; } lastClickTime = time; return false; } }
使用的时候: