TreKing wrote:
> On Fri, Dec 7, 2012 at 12:44 PM, skink <[email protected]> wrote:
>
> > try this:
> >
> >         String str = "http://www.google.com <a href=\"
> > http://www.google.com\";>Google</a>";
> >         Spanned html = Html.fromHtml(str);
> >         Object[] spans = html.getSpans(0, html.length(), URLSpan.class);
> >         tv.setAutoLinkMask(Linkify.ALL);
> >         tv.setText(html);
> >
> >         SpannableString ss = (SpannableString) tv.getText();
> >         for (int i = 0; i < spans.length; i++) {
> >             URLSpan span = (URLSpan) spans[i];
> >             int end = html.getSpanEnd(span);
> >             int start = html.getSpanStart(span);
> >             ss.setSpan(span, start, end, 0);
> >         }
> >
>
> Just want to add to this for posterity's sake.

me too, instead of passing 0 as the flags in setSpan it should be
rather:

int flags = html.getSpanFlags
(span);
ss.setSpan(span, start,
end, flags);

pskink

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