Reputation: 21
I am using Linkify.WEB_URLS to linkify URLs in text view, but it looks like there's a bug with the regex.
If I am doing this
noteView.setText("go to the website blabla (https://www.test.com/)");
Linkify.addLinks(noteView, Linkify.WEB_URLS);
It linkifies the closing ) too
Here's how it looks like: https://i.sstatic.net/XmOuT.png
Is there a way to fix that other than rewriting the regex completely and using the fixed one in my code? Or am I doing something wrong?
Upvotes: 2
Views: 773
Reputation: 374
The easiest way to get the closing parenthesis out of your link would be to put spaces around it, like this:
noteView.setText("go to the website blabla( http://www.test.com/ )");
You could also make the link look however you like if you wrap it in an anchor tag and then call Html.fromHTML on it, as shown in the solution here: How can I make links in fromHTML clickable? (Android)
Upvotes: 1