Ejemplo n.º 1
0
  /** @param view */
  public static void hideSoftKeyboard(final View view) {
    if (view == null) {
      return;
    }

    final Runnable action =
        new Runnable() {
          @Override
          public void run() {
            final InputMethodManager imm =
                (InputMethodManager)
                    view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(
                view.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
          }
        };

    view.postDelayed(action, 25);
  }