My question is this.
I can say in xml
android:digits="0123456789,"
But this time I've to it add trough java code.
customEditText.setKeyListener(DigitsKeyListener.getInstance("0123456789,"));
Doesn't work. Application gives me same result as android:InputType="number"
So is there any alternative way to say android:digits using java?
EDITED
So my question wasn't how to get android:InputType="number"
using java.
My question is that how I can get android:digits="0123456789,"
to be used with java.
At this point I don't care if the user can see characters. I just want my edittext field to accept only numbers from 0 to 9 and the decimal comma (,).
Because of the customEdittext is really a customized edittext I can't use xml atm.
try customEditText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);