We would like to know how to close Soft Input.
The following method shows how to close the soft input from the focused view.
It gets the InputMethodManager
first from the context and calls the
hideSoftInputFromWindow
to hide the soft input.
/*from w w w . ja va 2 s . c om*/ import android.content.Context; import android.view.View; import android.view.inputmethod.InputMethodManager; public class Main { public static void closeSoftInput(Context context, View focusingView) { InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(focusingView.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN); } }