Getting date as a String from android
<p>I made this little function:</p>

<pre><code>public String getDay() {

    String day = (String)android.text.format.DateFormat.format("E", new    java.util.Date());
    return day; 
}
</code></pre>

<p>I know that the <code>android.text.format.DateFormat.form("E", new java.util.Date());</code> Returns a CharSequence, but is there any problem regarding casting this from a sequence of char's? </p>

<p>I used the function like this:</p>

<pre><code>String day = getDay();
if(day == "Tue") {
        Toast.makeText(TaxiFaresActivity.this, day + " inside the if", Toast.LENGTH_LONG).show(); 
    }
</code></pre>

<p>But it seems to me that I ever get into the function? </p>

<p>If I but the Toast outside, I get the following Toast</p>

<blockquote>
  <p>Tue</p>
</blockquote>

<p>Which is right? Why doesn't the program jumps right into the if-sentence? </p>
