0
votes

I have an android application that shall correspond to French localization, where the Decimal Format for numbers shall have the Decimal Separator as "," rather than ".",

I need to let the EditText by default separate the decimal number with "," when entering a number in the EditText, where adding a textWatcher on every numeric field isn't an option, as there are many numeric fields, and many locales in which the user may run the application accordingly, and accordingly adding a text watcher for each locale isn't an option,

What am trying to do is to set the application DecimalFormatSymbols on login according to logged in culture, and accordingly all numeric EditText controls shall append the specified DecimalSeparator according to what specified after login via Example: using the method DecimalFormatSymbols.setDecimalSeparator(','),

Is that doable,

Please Advise!

1

1 Answers

0
votes

Workaround

char separator = DecimalFormatSymbols.getInstance().getDecimalSeparator();
editText.setKeyListener(DigitsKeyListener.getInstance("0123456789" + separator));