I want to make web links inside a textview clickable. I used this code
tv.setLinksClickable(true);
tv.setAutoLinkMask(Linkify.WEB_URLS);
Linkify.addLinks(tv, Linkify.WEB_URLS);
which does linkify the web site URLs but also seems to randomly link other text like z.xyz dzo.yzw and others.
How can I tell the linkify to only link URLs? To try and detect links starting with http:// or https:// beginnings I tried this pattern compiling
tv.setLinksClickable(true);
Pattern httpPattern = Pattern.compile("^(http|https)://");
Linkify.addLinks(tv, httpPattern,"");
but that did not work (no links were highlighted). Is that RegEx correct? What should the 3rd parameter to addLinks be?
Thanks for any tips to get this working.