Here you can find the source of hideKeyboard(Context context)
public static void hideKeyboard(Context context)
//package com.java2s; import android.app.Activity; import android.content.Context; import android.view.View; import android.view.inputmethod.InputMethodManager; public class Main { public static void hideKeyboard(Context context) { InputMethodManager inputManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); View view = ((Activity) context).getCurrentFocus(); if (view != null) { inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*from ww w .j a v a 2 s .c om*/ } }