I've got an EditText and I would like to set the text to uppercase. I used setFilters(new InputFilter[]{new InputFilter.AllCaps()}) which is working most of the time but not on Samsung with autocorrect and autocompletion.
On that kind of device each time I type a letter it replace the former one, leaving me with a 1 character text long. The only way to be able to type multiple characters is to lock caps on keyboard.
I would like to have a solution working on every device, does anyone know how to achieve that ?
This is Samsung's keyboard bug and you can't do anything with it. (except
android.os.Build.MANUFACTURER
check)Look at
InputFilter#filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend)
methodAnd the output for:
Normal device:
"s" 0 1 "" 0 0 -> "S"
"e" 0 1 "S" 1 1 -> "E"
Samsung:
"s" 0 1 "" 0 0 -> "S"
"e" 0 1 "S" 0 1 -> "E"
The Samsung's result doesn't differ from a such result in case you are going to replace one character with other one, for example with using Insert option of clipboard.