How to close Android Soft KeyBoard programmatically?(Kotlin & Java)
How to hide soft keyboard on android with code?
Note: Emulator does not appear, try live on the phone.
Note: Emulator does not appear, try live on the phone.
This file contains 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
//For Kotlin | |
val inputManager:InputMethodManager =getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
inputManager.hideSoftInputFromWindow(currentFocus.windowToken, InputMethodManager.SHOW_FORCED) | |
//For Java | |
InputMethodManager inputManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); | |
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.SHOW_FORCED); |
Yorumlar
Yorum Gönder