I'm making android application, that must check if there are any of words in the list and highlight them. I tried following code:
public void checkSyntax() {
//Text variable
data = et.getText().toString();
//Colored text
Spanned text = Html.fromHtml("<font color=\"red\">text</font>");
Spanned smth = Html.fromHtml("<font color=\"green\">its just example</font>");
Spanned owo = Html.fromHtml("<font color=\"blue\">i know html</font>");
//Replace words to colored text in string
data.replace("text", text);
data.replace("smth", smth);
data.replace("owo", owo);
//Set new text
et.removeTextChangedListener(tw);
et.setText(data);
et.addTextChangedListener(tw);
}