Let’s say you have the string:
"https://google.com to go to google. https://amazon.com to go to Amazon."
In a TextView, how would you replace the url’s with a link that shows “Click here” (or “Haz clic aquí” in spanish) and would take you to the correct url?
Keep in mind that the text is dynamic, it’s retrieved from the API, and there is no way to know if or how many links may be in any given post.
The finished product should look like this:
“Click here to go to google. Click here to go to Amazon.”
After many many hours…
Here is my solution. I put this code inside the
RecyclerView
adapter's
onBindViewHolder()
.