Android Utililty Methods Keyboard Hide

List of utility methods to do Keyboard Hide

Description

The list of methods to do Keyboard Hide are organized into topic(s).

Method

voidhideKeyBoard(View view, Activity activity)
hide Key Board
InputMethodManager imm = (InputMethodManager) activity
        .getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
voidhideKeyboard(Context context, EditText editText)
hide Keyboard
InputMethodManager imm = (InputMethodManager) context
        .getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
voidhideKeyboard(Context ctx, EditText editText)
hide Keyboard
InputMethodManager imm = (InputMethodManager) ctx
        .getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
voidhideKeyboard(View view)
hide Keyboard
try {
    InputMethodManager imm = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
} catch (Exception e) {
voidhideKeyboard(EditText editText)
hide Keyboard
InputMethodManager imm = (InputMethodManager) editText.getContext()
        .getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
voidhiddenKeyboard(Activity activity)
hidden Keyboard
try {
    InputMethodManager input = (InputMethodManager) activity
            .getSystemService(Activity.INPUT_METHOD_SERVICE);
    input.hideSoftInputFromWindow(activity.getCurrentFocus()
            .getWindowToken(), 0);
} catch (Exception e) {
    e.printStackTrace();
voidcloseSoftKeyboard(Activity activity)
close Soft Keyboard
if (activity == null)
    return;
InputMethodManager inputManager = (InputMethodManager) activity
        .getSystemService(Context.INPUT_METHOD_SERVICE);
View currentView = activity.getCurrentFocus();
if (currentView != null) {
    IBinder token = currentView.getWindowToken();
    if (token != null) {
...