How to manually dismiss the keypad in Android

If you want to dismiss the keypad manually through code, you can do that with the following methods Method 1: @Override public boolean dispatchTouchEvent(MotionEvent event) { View view = getCurrentFocus(); boolean ret = super.dispatchTouchEvent(event); if (view instanceof EditText) { View w = getCurrentFocus(); int scrcoords[] = new int[2]; w.getLocationOnScreen(scrcoords); float…continue reading →