Cata Cata - 1 month ago 7
Android Question

Links in TextView

I need to put a link in a

TextView
, I have a string that contains the tag
<a href="link">Text for link</a>
and some other text.
The problem is that if I run the project I can see the text but it's not clickable. I tried with the
<b>
tag too to see if that works and it seems that it doesn't work too.

How can I make this to work without the
Linkify
usage?

Answer

Thank you for your help all.

I have managed to make this work, after I have found some examples in the android samples.

here is the code:

textView.setText(Html.fromHtml(
            "<b>text3:</b>  Text with a " +
            "<a href=\"http://www.google.com\">link</a> " +
            "created in the Java source code using HTML."));
textView.setMovementMethod(LinkMovementMethod.getInstance());

Hope this help others...