fun EditText.showSoftKeyboard() {
requestFocus()
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.showSoftInput(this, 0)
}
fun EditText.hideSoftKeyboard() {
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.hideSoftInputFromWindow(windowToken, 0)
}
Last active
June 8, 2018 14:25
-
-
Save NielsMasdorp/218b4f19ce6aeb3ab8f009903fadc82b to your computer and use it in GitHub Desktop.
How to request focus on EditText and show keyboard and also hide
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment