Skip to content

Instantly share code, notes, and snippets.

@Nathaniel100
Created August 3, 2016 03:28
Show Gist options
  • Save Nathaniel100/bcb4136bd66a45c848f1c5ac9a9258b6 to your computer and use it in GitHub Desktop.
Save Nathaniel100/bcb4136bd66a45c848f1c5ac9a9258b6 to your computer and use it in GitHub Desktop.
hide soft keyboard
// Check if no view has focus:
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment