I have the following TextView defined:
After spending some time with this, I have found that:
android:autoLink="web"
works if you have full links in your HTML. The following will be highlighted in blue and clickable:
- Some text
http://www.google.com
- Some text
http://www.google.com
view.setMovementMethod(LinkMovementMethod.getInstance());
will work with the following (will be highlighted and clickable):
- Some text
http://www.google.com
- Some text
http://www.google.com
- Some text
Go to Google
Note that the third option has a hyperlink, but the description of the link (the part between the tags) itself is not a link. android:autoLink="web"
does NOT work with such links.
android:autoLink="web"
if set in XML will override view.setMovementMethod(LinkMovementMethod.getInstance());
(i.e.; links of the third kind will be highlighted, but not clickable).The moral of the story is use view.setMovementMethod(LinkMovementMethod.getInstance());
in your code and make sure you don't have android:autoLink="web"
in your XML layout if you want all links to be clickable.