Need help with switching to an activity if my form details match the string. So when the login button is pressed it will display main activity. This is the code I have so far:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
setupVariables();
}
private void setupVariables() {
username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password);
login = (Button) findViewById(R.id.button);
}
public void Login(View view) {
if (username.getText().toString().equals("admin") && password.getText().toString().equals("secret")) {
/* switches activity if the username and password matches the string */
}
else {
}
}
}