set View Click Delay - Android User Interface

Android examples for User Interface:Touch Event

Description

set View Click Delay

Demo Code


//package com.java2s;
import android.view.View;

public class Main {
    public static void setClickDelay(final View paramView, long paramLong) {
        if (paramView == null)
            return;
        paramView.setEnabled(false);//from  ww w. j  a  v a 2  s. c  om
        paramView.postDelayed(new Runnable() {
            public void run() {
                paramView.setEnabled(true);
            }
        }, paramLong);
    }

    public static void setClickDelay(final View paramView) {
        if (paramView == null)
            return;
        paramView.setEnabled(false);
        paramView.postDelayed(new Runnable() {
            public void run() {
                paramView.setEnabled(true);
            }
        }, 1000);
    }
}

Related Tutorials