I'm trying to replace a certain string with a span.
For example I have this String:
String s = "redHello greenWorld";
I wanna replace "red" with:
modifiedText.setSpan(new ForegroundColorSpan(Color.parseColor("#FF0000")), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
and "green" with:
modifiedText.setSpan(new ForegroundColorSpan(Color.parseColor("#00FF00")), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
So I create modifiedText this way:
Spannable modifiedText = new SpannableString(s);
How can I replace a certain String with a Span without HTML?