Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to detect German Umlauts in Android

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?

like image 482
Flipp95 Avatar asked Jun 15 '20 08:06

Flipp95


People also ask

How do I get an umlaut on my Android?

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.

How do you type ä?

ä = 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.


1 Answers

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
        }
    }

    ... 
}
like image 97
Philip Wong Avatar answered Oct 22 '22 10:10

Philip Wong