I want to compare a value from EditText the user will input it with a string I have it and it does not work at all here is the code:
public class MainActivity extends AppCompatActivity {
EditText username, password;
TextView text;
String s_username = "samer";
String s_password = "12345";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
username=findViewById(R.id.editTextText_user);
password=findViewById(R.id.editTextText_pass);
text=findViewById(R.id.t4);
}
public void sign_in (View v)
{
if(username.getText().toString()==s_username)
text.setText("Correct");
//text.setText("Correct");
}
every thing is working and if I reomve the // from the last row it will work but I need it to work after the if not alone