praveenb praveenb - 1 year ago 130
Android Question

How to set Edittext view allow only two numeric values and two decimal values like ##.##

I need to set validation for a edittext view should allow two numeric values and two decimal values.
example: 22.32

Please let me know how to do this validation

Thanks in advance

Answer Source
boolean isValid=<EditText Variable>.getText().toString().matches("\\d{2}\\.\\d{2}");

Put this method in a onClickListener and I guess you will be good to go.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download