android - Issue with anchor links when autoLink property is defined in xml -
i have set android:autolink="all" textview when try incorporate anchor link text view, anchor links not shown link.can help.
i think looking http://xjaphx.wordpress.com/2011/09/12/auto-link-for-textview/
textview.settext("any data"); linkify.addlinks(textview, linkify.all); see http://developer.android.com/reference/android/text/util/linkify.html
updated:
string urlink = "http://www.google.com"; string link = "<a href="+urlink+ ">link</a>"; textview tv = (textview) findviewbyid(r.id.textview); tv.settext(link); linkify.addlinks(tv, linkify.all); latest:
string googlelink = "http://www.google.com "; string clicklink = "click here"; spannable mspannablestring= new spannablestring(googlelink+clicklink); mspannablestring.setspan(new urlspan("http://www.google.com"), 0, googlelink.length(), 0); mspannablestring.setspan(new urlspan("http://www.example.com"), googlelink.length(), clicklink.length(), 0); textview tv = (textview) findviewbyid(r.id.textview); tv.setmovementmethod(linkmovementmethod.getinstance()); tv.settext(mspannablestring)
Comments
Post a Comment