Why can't I compare these 2 strings?
<p>For some reason, no matter what I type into my two textboxes, I get the matches response.
At first I was using <code>==</code> and that didn't work, so I tried switching to <code>if( a.equals( b ))</code></p>

<p>I'm still stuck.</p>

<p>Please help!</p>

<pre><code>package net.2TextboxesStringCompare;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import android.widget.EditText;

/*
 * 2TextboxesStringCompare
 */


public class Code8 extends Activity implements OnClickListener {

    Button accept;
    EditText numberStudents, numberStudents2;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);


        numberStudents = new EditText(this);
        numberStudents2 = new EditText(this);

        // find our button in the UI by its ID
        accept = (Button)findViewById(R.id.accept);

        // set listeners for the button. Since our current class
        // implements the OnClickListener interface
        // we can simply pass the current object ("this") into
        // the listener. The appropriate method will therefore
        // be called when the event fires.
        accept.setOnClickListener(this);

    }

    /* implement an event handler that responds to click events */
    public void onClick(View v){
        String a = numberStudents.getText().toString();
        String b = numberStudents2.getText().toString();
        if( a.equals( b ) )
            Toast.makeText(getApplicationContext(), "Matches", 
            Toast.LENGTH_SHORT).show();
        else
            Toast.makeText(getApplicationContext(), numberStudents.getText()+" !=      
            "+numberStudents2.getText(), Toast.LENGTH_SHORT).show();
    }

}
</code></pre>
