How to hide soft keyboard on android after clicking outside EditText?
The following snippet simply hides the keyboard: public static void hideSoftKeyboard(Activity activity) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService( Activity.INPUT_METHOD_SERVICE); if(inputMethodManager.isAcceptingText()){ inputMethodManager.hideSoftInputFromWindow( activity.getCurrentFocus().getWindowToken(), 0 ); } } You can put this up in a utility class, or if you are defining it within an activity, avoid the activity parameter, or call hideSoftKeyboard(this). The trickiest part is … Read more