My EditText
should only accept a 3 digit number, not any other decimal numbers. I used the below regular expression to do that but this is even accepting characters like "." and "-". So how do you avoid accepting decimal values?
Java:
pattern=Pattern.compile("[0-9]{0,2}");
XML:
android:digits="0123456789"
android:inputType="number"
Try this:
android:inputType="number|none"
android:maxLength="3"
android:digits="0123456789"
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