Q:

setTextColor() - Logic Error

Hello I'm Having a problem with my simple Android Application, it can't change the Text Colors in the other Activity which is displayActivity.java Here's my Code sample.
The problem is if the texts are both equal it will change into color greensuccess
but it did change into rederror
MainActivity.java
public class MainActivity extends AppCompatActivity {
public static final String xy = "ict402.germio.intent";
public static final String xz = "ict402.germio.intent";
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

}

    public void send(View view){

        EditText a = findViewById(R.id.a);
        EditText b = findViewById(R.id.b);

        String strx =(a.getText().toString());
        String stry =(b.getText().toString());

        if (strx.compareToIgnoreCase(stry) == 0)
        {
            // this line WILL print

            Intent i = new Intent(this, displayActivity.class);

            String t = ("Case Ignored \n VALUES ARE THE SAME CONGRATS!").toString();
            i.putExtra(xy,t);
            startActivity(i);

        } else {
            Intent i = new Intent(this, displayActivity.class);

            String y = ("Case Ignored \n VALUES ARE NOT THE SAME SORRY!").toString();
            i.putExtra(xz,y);
            startActivity(i);

        }

    }
}

displayActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display);

    Intent i = getIntent();
    String message = i.getStringExtra(MainActivity.xy);
    TextView t = findViewById(R.id.x);
    t.setTextColor(getResources().getColor(R.color.success));
    t.setText(message);

    Intent o = getIntent();
    String msg = o.getStringExtra(MainActivity.xz);

    TextView q = findViewById(R.id.x);
    q.setTextColor(getResources().getColor(R.color.error));
    q.setText(msg);

    }
}

A:

There are so many things wrong. Here's a replacement:
public void send(View view) {
    String editTextAContents = findViewById(R.id.a).getText().toString();
    String editTextBContents = findViewById(R.id.b).getText().toString();

    Intent intent = new Intent(this, DisplayActivity.class);

    if (editTextAContents.equalsIgnoreCase(editTextBContents)) {
        intent.putExtra("message", "Case Ignored \n VALUES ARE THE SAME CONGRATS");
        intent.putExtra("error", false);
    } else {
        intent.putExtra("ict402.germio.intent", "Case Igored \n VALUES ARE NOT THE SAME SORRY!");
        intent.putExtra("error", true);
    }

    startActivity(intent);
}

In DisplayActivity:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display);

    Intent intent = getIntent();

    String message = intent.getStringExtra("message");
    boolean hasError = intent.getBooleanExtra("error", false);

    TextView textView = findViewById(R.id.x);

    textView.setText(message);

    if (hasError) {
        textView.setTextColor(ContextCompat.getColor(this, R.color.error));
    } else {
        textView.setTextColor(ContextCompat.getColor(this, R.color.success));
    }
}

When you populate an Intent's extras, they must have a different name.
When you declare variables, be more verbose instead of naming them x, y, z, a, b, c so they are more readable.

