I think you might need this code:
private static final void addLinkMovementMethod(TextView t) {
MovementMethod m = t.getMovementMethod();
if ((m == null) || !(m instanceof LinkMovementMethod)) {
if (t.getLinksClickable()) {
t.setMovementMethod(LinkMovementMethod.getInstance());
}
}
}
Source:
http://google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/text/util/Linkify.java&q=addLinkmovementmethod
Let me know if this works.
On May 7, 8:49 am, rain <[email protected]> wrote:
> I find a way to display the link text:
>
> TextView tv = new TextView(this);
> SpannableString str = SpannableString.valueOf("google");
> str.setSpan(new URLSpan("http://www.google.com"), 0, 6,
> Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
> tv.append(str);
>
> but when i click the text, there will not trigger the open browser
> action.
>
> any help! thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---