I'm trying to replace part of an Editable
returned from getText()
with a span.
I've tried getText().replace()
but that's only for CharSequences
.
The reason I'm trying to do this is so I can highlight sections of an EditText
one after another (after a small delay), instead of going through and highlighting the whole EditText
(which can be slow with big files).
Does anyone have a clue about how I'd go about doing this?
This minimal size example makes the word 'first' large:
You can adapt it to your needs
I answered a smilar question recently: How to use SpannableString with Regex in android?. But I'll add a copy of that answer.
Here's a class that will help you:
And an example of usage: