InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if(imm == null) { // imm might be null return; } imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0);