Android How to - Hide Soft Input








Question

We would like to know how to hide Soft Input.

Answer

//from  w ww .ja  v a2  s  .c  om
import android.app.Activity;
import android.view.WindowManager;

public class Main {
  public static void hideSoftInput(Activity activity) {
    activity.getWindow().setSoftInputMode(
        WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  }

}