Android Linkify not detecting some new top-level domains

372 Views Asked by At

I am using Linkify to detect URLs in a text view

Linkify.addLinks(messageText, Linkify.WEB_URLS);

it works great and detect "most" URLs, however, it seems that the class regex is pre set to detect certain domains only. I came across this URL http://kodi.wiki/ and Linkify failed to detect it as a URL. It also doesn't detect some others like

http://test.menu
http://test.link
http://test.foo

So is it safe/wise to just use some URL regex to detect URLs (doamin names and IPs)? or shall I just live with this and wait for google to fix Linkify?

(Note: i don't like regex since from experience I cannot predict what weird glitches I might encounter with them)


UPDATE

There was a bug report created for Android here which state that the problem got fixed in Android 5, so there will be no fix for android versions prior to that. And based on the comments it seems like google are now using regex to match URLs without validating gTLDs, which I think is the way to do it on devices that cannot be updated easily.

0

There are 0 best solutions below