public static void hideKeyboard(Context context) {
try {
InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 0);
} catch (Exception e) {
Log.e(TAG, "Sigh, can't even hide keyboard " + e.getMessage());
}
}
try {
InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 0);
} catch (Exception e) {
Log.e(TAG, "Sigh, can't even hide keyboard " + e.getMessage());
}
}
No comments:
Post a Comment