Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linkify.addLinks with Span not working

I have textview with autoLink, but whenever i add custom span (ClickableSpan) to textview its auto link to web url and mobile number is not working. is there any easy way to solve this issue. Style is applied but click is not working.

like image 792
Bincy Baby Avatar asked Sep 08 '17 08:09

Bincy Baby


1 Answers

https://stackoverflow.com/a/39494610/4639479 I used this answer and worked fine

public static String[] extractLinks(String text) {
    List<String> links = new ArrayList<String>();
    Matcher m = Patterns.WEB_URL.matcher(text);
    while (m.find()) {
        String url = m.group();
        links.add(url);
    }
    return links.toArray(new String[links.size()]);
}
like image 122
Bincy Baby Avatar answered Oct 31 '22 12:10

Bincy Baby