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?
Umlauts on an iOS or Android deviceEither in the notes app or any app that uses the virtual keyboard, press the key for the vowel you want and hold it until the pop-up options menu appears. Slide your finger over to select the umlaut you need. This process is the same on both iOS and Android devices.
ä = Hold down the Control and Shift keys and type a : (colon), release the keys, and type an a. Ä = Hold down the Control and Shift keys and type a : (colon), release the keys, hold down the Shift key and type an a. ö = Hold down the Control and Shift keys and type a : (colon), release the keys, and type an o.
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
}
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With