I set InputType.TYPE_NUMBER_FLAG_DECIMAL or InputType.TYPE_CLASS_NUMBER to my EditText and i want to use comma for decimal separator. So i set digits "0123456789.," to EditText.
editText.keyListener = DigitsKeyListener.getInstance("0123456789.,")
I set a TextWatcher on EditText to handle user input. When i clicked comma(",") on Android emulator keyboard, it is working as expected but if i get build on my phone, which has Samsung Keyboard, comma key is disabled and doesnt work. I searched so much but i couldn't find a way.
Any idea with this problem?

I solved in this way
override fun afterTextChanged(editable: Editable) {
// If the user input from keyboard some special characters like dot, we replace it programmatically with comma
if (editable.toString().contains(".")) {
editable.delete(editable.toString().length - 1, editable.toString().length)
editable.insert(editable.toString().length, ",")
return
} }
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