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; /* www . j a v a 2 s .co m*/ import android.text.TextUtils; import android.widget.EditText; /** * A simple validator that validates the field only if the value is the same as another one. * @author Andrea Baccega <me@andreabaccega.com> * */ public class SameValueValidator extends Validator { private final EditText otherEditText; public SameValueValidator(EditText otherEditText, String errorMessage) { super(errorMessage); this.otherEditText = otherEditText; } @Override public boolean isValid(EditText editText) { return TextUtils.equals(editText.getText(), otherEditText.getText()); } }