Created
December 21, 2015 14:47
-
-
Save hector6872/5fcac5c5da8a017fc53e to your computer and use it in GitHub Desktop.
Hide SoftKeyboard
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
public void hideSoftKeyboard(Activity context) { | |
View view = context.getCurrentFocus(); | |
if (view == null) { | |
return; | |
} | |
InputMethodManager inputMethodManager = | |
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); | |
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), | |
InputMethodManager.HIDE_NOT_ALWAYS); | |
view.clearFocus(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment