Skip to content

Instantly share code, notes, and snippets.

@GluTbl
Last active March 26, 2020 15:25
Show Gist options
  • Save GluTbl/20643424c99398b55eb24a67abe13b3e to your computer and use it in GitHub Desktop.
Save GluTbl/20643424c99398b55eb24a67abe13b3e to your computer and use it in GitHub Desktop.
[Hide focus in edit text] #Kotlin
private fun hidefocus(v:View?) {
try {
val imm =getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
if (v != null) {
imm.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS)
}
} catch (ignored: Exception) {
}
edit_port.setSelected(false)
edit_port.setFocusable(false)
edit_port.setFocusableInTouchMode(true)
edit_password.setSelected(false)
edit_password.setFocusable(false)
edit_password.setFocusableInTouchMode(true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment