General Android System Classes and Examples.
/** * Click processing: prevent repeated clicks * Generally, add the following code to the first line of the click event. * if (ClickUtil.isFastDoubleClick()) return; */ public class ClickUtil { //The shortest interval private static int clipTime = 800; private static long loadClickTime ; public static boolean isFastDoubleClick () { long time = System.currentTimeMillis(); long timeD = time - lastClickTime; if (0 < timeD && timeD < clipTime) { returntrue; } lastClickTime = time; returnfalse; } public static boolean isFastDoubleClick ( int clipTime ) { long time = System.currentTimeMillis(); long timeD = time - lastClickTime; if(0<timeD&&timeD<clipTime){ returntrue; } lastClickTime=time; returnfalse; } }