private void createStringEndingInRedColor(TextView tv, String word1, String word2) { Spannable word = new SpannableString(word1); tv.setText(word); Spannabl
You can get the color of the Spannable from TextView using getSpans() method
Spannable
TextView
getSpans()
ForegroundColorSpan[] colorSpans = ((SpannableString)textView.getText()).getSpans(0, textView.getText().length(), ForegroundColorSpan.class); assertTrue(colorSpans[0].getForegroundColor() == Color.RED)