@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log);
Name = (EditText)findViewById(R.id.ETNAME);
Password = (EditText)findViewById(R.id.ETpassword);
Info = (TextView)findViewById(R.id.TVinfo);
Login = (Button)findViewById(R.id.BTlogin);
Info.setText("No of attempts remaining: 5");
Login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validate(Name.getText().toString(), Password.getText().toString());
}
});
}
private void validate(String UserName, String UserPassword){
if((UserName == "Starlite") && (UserPassword == "abc123")){
Intent intent = new Intent(LOGActivity.this, InterfaceActivity.class);
startActivity(intent);
}else{
counter--;
Info.setText("No of attempts remaining: " + String.valueOf(counter));
if(counter == 0){
Login.setEnabled(false);
}
}
}
}
This is my code and I created it to log to a profile. But I can not login with it. What is the error of it? The following are the top code. I done with it with tutorials. But it not working.It was verified in 5 times. But can not log to it.