I'm trying to print a toast msg if the username and password is equal to admin i try this code but the toast msg says it's error and the logcat doesn't show anything
code i tried
public class login extends AppCompatActivity {
DatabaseHelper db;
EditText username,password;
Button login;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
db = new DatabaseHelper(this);
username = findViewById(R.id.username);
password = findViewById(R.id.password);
login = findViewById(R.id.login);
adminLogin();
}
public void toast(Context context, String string){
Toast.makeText(this,string, Toast.LENGTH_SHORT).show();
}
public void adminLogin(){
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(username.getText().toString() == "admin" || password.getText().toString() == "admin"){
toast(login.this,"Done");
}
else{
toast(login.this,"Error");
}
}
});
}
}