-1
EditText un = (EditText) findViewById(R.id.username1);    
EditText pw = (EditText) findViewById(R.id.password1);    
String u = un.getText().toString();    
String p = pw.getText().toString();    
String myUser = "user1";    
String myPass = "pass1";    
public void onClickL (View view){    
  if ( (u == myUser) && (p == myPass)) /////// phone should alarm    
  else //////error    
}
wogsland
  • 9,106
  • 19
  • 57
  • 93

1 Answers1

0

Change this line

if ( (u == myUser) && (p == myPass))  

to

if (u.equals(myUser) && p.equals(myPass))

Full code

EditText un = (EditText) findViewById(R.id.username1);


EditText pw = (EditText) findViewById(R.id.password1);

String u = un.getText().toString();

String p = pw.getText().toString();

String myUser = "user1";

String myPass = "pass1";

public void onClickL (View view){

if (u.equals(myUser) && p.equals(myPass)){ /////// phone should alarm

else //////error

}
Inducesmile
  • 2,475
  • 1
  • 17
  • 19