Created
April 15, 2022 08:51
-
-
Save massimilianochiodi/b1657f92148e7886d733a0e877985aab to your computer and use it in GitHub Desktop.
Hide keyboard ( java )
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 hideKeyBoardMethod(final Context context, final View view) { | |
try { | |
view.post( () -> { | |
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); | |
assert imm != null; | |
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); | |
} ); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment