I have a simple password protection. I do it like this:
EditText editText1 = (EditText) findViewById(R.id.editText1);
String Password = editText1.getText().toString();
if(Password == "a"){
Toast.makeText(getApplicationContext(), "Success" + Password, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Failure" + Password, Toast.LENGTH_SHORT).show();
}
I have edittext and button. If user is typing in "a", toast should say success. But it is always saying failure. I don't understand what is wrong in my code...