On Thu, Dec 6, 2012 at 11:13 PM, TreKing <[email protected]> wrote:
> I'm trying to display some text that I get from various web sources in some
> TextViews. The data is out of my control and may contain links to other
> sites. The links may be "raw" or "anchored". By this I mean:
>
> Raw link is like http://www.google.com
> Anchored link is like <a href="http://www.google.com";>Google</a>
>
> I set the text on the TextView using Html.fromHtml().
>
> I'd like to be able to click any of these links to go to the linked sites,
> but apparently the TextView can only support one or the other but not both
> of these at the same time .. ?
>
> I can use the autoLink=true property on the TextView to make raw links
> clickable, but the anchor links are not affected.

Use Html.fromHtml() on your input string before passing it to the
TextView. That should handle your anchor links. With luck, it will
leave the autoLink behavior as-is.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.4 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to