New course! Every coder should learn Generative AI!
Try a free lesson+ 3
Insert HTML code for color around word and set it to your textView .
String newString = oldString.replaceAll(textToHighlight, "<font color='red'>"+textToHighlight+"</font>");
textView.setText(Html.fromHtml(newString));