Created
March 17, 2020 02:24
-
-
Save alidaoud/6c4c55d3aea20fbc614cbcbdebfe5d00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void hideKeyboard(Activity activity) { | |
| InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); | |
| View view = activity.getCurrentFocus(); | |
| if (view == null) { | |
| view = new View(activity); | |
| } | |
| if (inputMethodManager != null){ | |
| inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment