BluetoothTest.java
colourSpinner = (Spinner) findViewById(R.id.colourSpinner);
    ArrayAdapter adapter = ArrayAdapter.createFromResource(this,
            R.array.colour, android.R.layout.simple_spinner_item);
    colourSpinner.setAdapter(adapter);
-
-
-
void redButton() throws IOException {
    if(colourSpinner.getSelectedItem().toString() == "Red")
    {
        Toast.makeText(getApplicationContext(), 
        colourSpinner.getSelectedItem().toString(), Toast.LENGTH_LONG).show();
        mmOutputStream.write("1".getBytes());
    }
}
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Computer Case Controller</string>
<string-array name="colour">
    <item>Red</item>
    <item>Green</item>
    <item>Blue</item>
    <item>Cyan</item>
    <item>Magenta</item>
    <item>Yellow</item>
    <item>White</item>
</string-array>
Hey I have a problem that I've been trying to solve for a while now, I don't understand why my code doesn't work as intended.
Basically redButton() sends the command "1" over bluetooth, while also creating a toast saying the colour of the Spinner selection. I've narrowed it down to the if statement not working, but I don't understand why colourSpinner.getSelectedItem().toString() doesn't equal "Red" even if that is what it outputs if I set it to toast the colour without the if statement
Am I missing something?
 
     
     
    