Android Open Source - ExpertAndroid Password Field Rule

From Project

Back to project page ExpertAndroid.


The source code is released under:

MIT License

If you think the Android project ExpertAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.androidbook.parse;
//from www. j a v  a 2s .  c o  m
import android.widget.TextView;

public class PasswordFieldRule implements IValidator

  private TextView password1;
  private TextView password2;
  public PasswordFieldRule(TextView p1, TextView p2)
    password1 = p1;
    password2 = p2;
  public boolean validate() 
    String p1 = password1.getText().toString();
    String p2 = password2.getText().toString();
    if (p1.equals(p2))
      return true;
    //They are not the same
    password2.setError("Sorry, password values don't match!");
    return false;

Java Source Code List