I am trying to detect german umlauts with a soft keyboard. To recognize the entered characters I use the method onKeyUp()
. But this method is not executed for German umlauts.
Is there a way for me to recognize them?
I am trying to detect german umlauts with a soft keyboard. To recognize the entered characters I use the method onKeyUp()
. But this method is not executed for German umlauts.
Is there a way for me to recognize them?
In general it is not a good idea to check for language specific characters with KeyListener
. For this use case it is better to use TextWatcher
.
object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
val umlaut = "\u00FC"
if (!s.isNullOrEmpty() && s[count - 1].toString() == umlaut) {
// Do your thing
}
}
...
}