code: public static void hide(Context context, View v) {
          InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
          manager.hideSoftInputFromWindow(v.getWindowToken(), 0);
      }
docs: Hide the software input window.
  @param context the context.
  @param v the view that holds the window token.