Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 892
Cata Avatar asked Jan 25 '11 06:01

Cata


1 Answers

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...

like image 143
Cata Avatar answered Sep 23 '22 06:09

Cata