Back to project page Android-sample.
The source code is released under:
Apache License
If you think the Android project Android-sample 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 ww .j a v a 2s. co m 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()); } }