Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public static void hideKeyboard(Activity context) {
  2. View currentFocus = context.getCurrentFocus();
  3. if (currentFocus != null) {
  4. InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
  5. if (imm != null) {
  6. imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
  7. }
  8. }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement