防止按钮连续点击
共通方法:
public class Utils { private static long lastClickTime; public static boolean isFastDoubleClick() { long time = System.currentTimeMillis(); if ( time - lastClickTime < 500) { return true; } lastClickTime = time; return false; } }
按钮点击时:
public void onClick(View v) { if (Utils.isFastDoubleClick()) { return; } }