If-statement dont get true, but it should
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java">How do I compare strings in Java?</a>  </p>
</blockquote>



<p>I dont understand why the the first (same for other ones) <code>if</code> in sendMessage never gets true. The reciever String is exactly what it should be to be true?!  </p>

<p>When i run this and press <strong>send to Alice</strong> I get 3 Toast:</p>

<ol>
<li>Send to Alice (=value of reciever)</li>
<li><em>[a blank toast]</em> (=value of phoneNumber)</li>
<li><p>You have to choose a message (=nevermind this!)</p>

<pre><code>public void onSend(View src){
Button b = (Button)src;

sendMessage(b.getText().toString());

}

public void sendMessage(String reciever){

String phoneNumber = "";
Toast.makeText(this, reciever, Toast.LENGTH_LONG).show();

if (reciever == "Send to Alice"){
    phoneNumber = "01230340645";
    Toast.makeText(this, "hej", Toast.LENGTH_LONG).show();
}

else if (reciever == "Send to Bob"){
    phoneNumber = "020312039";
}

else if (reciever == "Send to John"){
    phoneNumber = "0102308013";
}

Toast.makeText(this, phoneNumber, Toast.LENGTH_LONG).show();

if (_message == ""){
    Toast.makeText(this, "You have to choose a message!", Toast.LENGTH_LONG).show();
} else {
    Intent sms = new Intent(Intent.ACTION_SENDTO, Uri.parse("sms:" + phoneNumber));
    sms.putExtra("sms_body", _message);
    startActivity(sms);
    _message = "";
}

 }
</code></pre></li>
</ol>
