How to restrict an EditText Field to only one decimal point. Let's say the user should enter only one digit/number after the (.)[decimal].
User enters : 1.92 [Its invalid]
User enters : 1.9 [Its Valid]
Below is the regular expression i am using.
mPattern = Pattern.compile("[0-9]*+((\\.[0-9]{0," + (digitsAfterZero - 1) + "})?)||(\\.)?");
I am having problems with the decimals, user if enter 23.1
its fine, but the same user can enter 2.31
.
How can i restrict user to enter only one number/digit after decimal.