I have the following TextView defined:
The accepted answer is correct, BUT it will mean that phone numbers, maps, email addresses, and regular links e.g. http://google.com
without href tags will NO LONGER be clickable since you can't have autolink in the xml.
The only complete solution to have EVERYTHING clickable that I have found is the following:
Spanned text = Html.fromHtml(myString);
URLSpan[] currentSpans = text.getSpans(0, text.length(), URLSpan.class);
SpannableString buffer = new SpannableString(text);
Linkify.addLinks(buffer, Linkify.ALL);
for (URLSpan span : currentSpans) {
int end = text.getSpanEnd(span);
int start = text.getSpanStart(span);
buffer.setSpan(span, start, end, 0);
}
textView.setText(buffer);
textView.setMovementMethod(LinkMovementMethod.getInstance());
And the TextView should NOT have android:autolink
. There's no need for android:linksClickable="true"
either; it's true by default.