0

I have the following code:

EditText edit = (EditText) findViewById(R.id.bluetractor);
         if (edit.getText().toString().equals("Blue Tractor"))
         {
         Toast.makeText(getApplicationContext(), "Correct", Toast.LENGTH_LONG).show();
         }
         else
         {
       edit.setError("Incorrect");
         }

But when I click the button that executes the code, it all works well apart from the fact the writing (the "Incorrect") appears to be white and therefore it is not visible on the white background of the error popup. Can anyone help? Thanks

cnfw
  • 770
  • 2
  • 11
  • 28

2 Answers2

0

couldn't you either change the color in the XML for that view or

setError("error").setTextColor(bleh)
Rarw
  • 7,645
  • 3
  • 28
  • 46
  • For this method do i just type in "red" or the colour code for red (FF0000)? – cnfw Feb 12 '13 at 21:11
  • You have to make a colors xml file in values and set it programatically check [this](http://stackoverflow.com/questions/7548653/settextcolor-of-textview-programatically) out. You will assign it like selecting any other resource. – Rarw Feb 12 '13 at 21:16
0

It can be done in xml by setting

<item name="android:textColorSecondaryInverse"></item>

Alternatively, you can use setError with a Spannable String

jimmithy
  • 6,360
  • 2
  • 31
  • 29