Comparing text from EditText with string from database
<p>This code should compare text entered into <strong>R.id.editUserName</strong> with <strong>R.string.DB_username</strong> and, if they match, log you in, else show a toast that they don't match.</p>

<pre><code>public void signIn(View view) {

  EditText editUserName = (EditText)findViewById(R.id.editUserName);
  String userName = editUserName.getText().toString();

  if ( userName ==  getResources().getString(R.string.DB_username)) {
    // log in
    setContentView(R.layout.screen1);
  } else {
    // show toast
    Toast toast = Toast.makeText(getApplicationContext(), userName+" != "+getResources().getString(R.string.DB_username), Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
  }
}
</code></pre>

<p>Even when they do match, it still shows a toast, such as "Roger != Roger"... how could that be?</p>
