1public static void hideSoftKeyboard(Activity activity) {
2 InputMethodManager inputMethodManager =
3 (InputMethodManager) activity.getSystemService(
4 Activity.INPUT_METHOD_SERVICE);
5 inputMethodManager.hideSoftInputFromWindow(
6 activity.getCurrentFocus().getWindowToken(), 0);
7}
1InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
2imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);