Android – Awesome Validation for password confirmation

I am not able to validate the confirmed password in the edittext.

String regexPassword = "//d{1}//d{1}//d{1}//d{1}";
    String ConfirmregexPassword = MPIN.getText().toString().trim();
    awesomeValidation.addValidation(this, R.id.MPIN, regexPassword, R.string.MPINError);
    if (ConfirmMPIN.getText().toString().trim()!=MPIN.getText().toString().trim() ) {
        awesomeValidation.addValidation(this, R.id.ConfirmMPIN, ConfirmregexPassword, R.string.ConfirmMPIN);
        Toast.makeText(RegisterActivity.this, "Message", Toast.LENGTH_LONG).show();
    }

use .equals() method

 if ((ConfirmMPIN.getText().toString().trim()).equals((MPIN.getText().toString().trim()) )) {
            Toast.makeText(RegisterActivity.this, "if", Toast.LENGTH_LONG).show();
        }
        else{
            Toast.makeText(RegisterActivity.this, "else", Toast.LENGTH_LONG).show();
        }

when you have to compare two String you can use String.equals() method which is used to Compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.

try this

 awesomeValidation.addValidation(this, R.id.ConfirmMPIN, ConfirmregexPassword, R.string.ConfirmMPIN);

or try this

if (ConfirmMPIN.getText().toString().trim().equals(MPIN.getText().toString().trim() )) {

    Toast.makeText(RegisterActivity.this, "Password Match", Toast.LENGTH_LONG).show();
 }else{

   Toast.makeText(RegisterActivity.this, "Not Matched", Toast.LENGTH_LONG).show();  
}