Android: IF statement with radio buttons not working
<p>I am trying to make a quiz app, so there are 5 radio buttons with possible answers, and only 1 is correct. Then there's a submit button, which has an onClick="clickMethod" to process the submission. </p>

<p>My clickMethod looks like this:</p>

<pre><code>public void clickMethod(View v){
                RadioGroup group1 = (RadioGroup) findViewById(R.id.radioGroup1);
                int selected = group1.getCheckedRadioButtonId();
                RadioButton button1 = (RadioButton) findViewById(selected);
                if (button1.getText()=="Right Answer")
                    Toast.makeText(this,"Correct!",Toast.LENGTH_SHORT).show();
                else
                    Toast.makeText(this,"Incorrect.",Toast.LENGTH_SHORT).show();
    }
</code></pre>

<p>However I can't get the IF statement to work no matter what. If I try to make the toast with 
 "button1.getText()" as parameter it does print the "Right Answer" string, but for some reason inside the IF statement it's not working, and the ELSE is always executed even when I check the right answer.</p>

<p>Does anyone know what might be happening or a better way to do this?</p>
