I am trying to do this, users are signing up, and for the password field I don't want to have two password fields (like traditionally password and the other is for confirm password) I want to have only one edittext and when after entering the password for first time and loose focus, well the below code is self-explanatory
passwordSgnup_et.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus ) {
if (i <= 0) {
passwordSgnup_et.requestFocus();
cfmPasswordSgnup = Password;
passwordSgnup_et.getText().clear();
passwordSgnup_et.setHint("Confirm Password");
if (passwordSgnup_et.getText().toString() .equals( cfmPasswordSgnup)) {
ParseUser userSignup = new ParseUser();
userSignup.setUsername(Name);
userSignup.setEmail(Email);
userSignup.setPassword(Password);
userSignup.put("Nickname",nickName);
Problem that I am facing is this. How can I know if the confirm password is entered and matches with the one entered the first time. I am confused there. Also to exit after the confirm password matches with the first password I am using the good old int i <= 0 logic anyway to improve this?
EDIT: This question was closed as a duplicate simply referring to another equals to question, MY QUESTION being is that, in the logic you can see that,
passwordSgnup_et.setHint("Confirm Password");
if (passwordSgnup_et.getText().toString() .equals( cfmPasswordSgnup)) {
in between these two lines i need to take in the userinput (confirmpassword) to actually compare with the first password, that is what I am not able to get it.