My string could look like this: Numbers: [3]
or Numbers: [213]
How I can find []
and number inside it and change color of [] and number?
This problem can be divided into 2 sections
var text :String = "<font color=#000>[</font><font color=#6ab04c>213</font><font color=#000>]</font>";
textview.setText(Html.fromHtml(text));
In the textwatcher search for the occurrence of the '[' and then format the string accordingly. so a non optimal solution would be str1= "[" str2="219" str3="]"
Now construct the string as mentioned in the section and then set to the textview