My activity it's a simple login activity where (for tests only) it will return true if the username && password are equal and false if not.
But it always return false.
Not even if I convert toString(); example:
String a=(txtUserName.getText().toString() == txtPassword.getText().toString()) ? "equal" : "Nequal";
Full code:
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_login);
  txtUserName = (EditText) this.findViewById(R.id.txtUname);
  txtPassword = (EditText) this.findViewById(R.id.txtPwd);
  btnLogin = (Button) this.findViewById(R.id.btnLogin);
  btnLogin.setOnClickListener(new OnClickListener() {
    @Override
      public void onClick(View v) {
      Toast.makeText(LoginActivity.this,txtUserName.getText(),Toast.LENGTH_LONG).show();
      Toast.makeText(LoginActivity.this,"Just for separate", Toast.LENGTH_LONG).show();
      Toast.makeText(LoginActivity.this,txtPassword.getText(), Toast.LENGTH_LONG).show();
      String a=(txtUserName.getText() == txtPassword.getText()) ? "equal" : "Nequal";
      Toast.makeText(LoginActivity.this, a, Toast.LENGTH_LONG).show();
    }
  });
}  
 
     
     
     
    