Unable to add ForegroundColorSpan

Try this

    SpannableStringBuilder sb = new SpannableStringBuilder("Hello World");
    int color = getResources().getColor(R.color.text_blue);
    ForegroundColorSpan fcs  =new ForegroundColorSpan(color);
    sb.setSpan(fcs, 0, sb.length(),0);
    TextView tv= (TextView) findViewById(R.id.textView1);
    tv.setText(sb);

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="text_blue">#FF39ACEE</color>
</resources>

Snap

enter image description here

The below did not work

ForegroundColorSpan fcs = new ForegroundColorSpan(R.color.text_blue);
sb.setSpan(fcs, 0, sb.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 

In the case of the question - the colour passed into the ForegroundColorSpan was not yet resolved.

However on a side note, adding a ForegroundColorSpan to a TextView that has the attribute allCaps="true" will not work.

Remove the allCaps attribute, programatically change the capitalisation of the string BEFORE passing it to the constructor the SpannableStringBuilder.