So, this is my Android MainActivity, but specifically this code:
public void checkUser(View view) {
// Next Activity to move on to
Intent intentSuccess = new Intent(this, Home.class);
Intent intentFail = new Intent(this, LoginFailActivity.class);
EditText usernameText = (EditText) findViewById(R.id.user_field);
String username = usernameText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.pword_field);
String password = passwordText.getText().toString();
if (username == "admin" && password == "password") {
startActivity(intentSuccess);
} else {
startActivity(intentFail);
}
}
Even when I type in "admin" and "password" it goes to intentFail every time. I have checked with a test activity and it properly passes the strings to it without issue.
Please help me and thank you in advance!!