Back to project page android-edittext-validator.
The source code is released under:
MIT License
If you think the Android project android-edittext-validator listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.andreabaccega.formedittextvalidator; /*from w w w . j a v a 2s.c om*/ import android.text.TextUtils; import android.widget.EditText; /** * A validator that returns true only if the input field contains only numbers. * @author Andrea Baccega <me@andreabaccega.com> * */ public class NumericValidator extends Validator{ public NumericValidator(String _customErrorMessage) { super(_customErrorMessage); } public boolean isValid(EditText et) { return TextUtils.isDigitsOnly(et.getText()); } }