Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.os.Handler;
import android.support.annotation.StringRes;
import android.widget.EditText;

public class Main {
    public static void setHint(@StringRes final int res, EditText editText) {
        editText.setOnFocusChangeListener((v, hasFocus) -> {
            if (hasFocus) {
                new Handler().postDelayed(() -> editText.setHint(res), 200);
            } else {
                editText.setHint(null);
            }
        });
    }
}