Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.os.Handler;

import android.view.View;

public class Main {

    public static void setDelayedEnable(final View v, int delayMillis) {
        v.setEnabled(false);
        setDelayedClickable(v, true, delayMillis);
    }

    public static void setDelayedClickable(final View v, int delayMillis) {
        v.setClickable(false);
        setDelayedClickable(v, true, delayMillis);
    }

    private static void setDelayedClickable(final View v, final boolean clickable, int delayMillis) {
        new Handler().postDelayed(() -> {
            v.setClickable(clickable);
            v.setEnabled(true);
        }, delayMillis); //
    }
}