Android Linkify text – Spannable Text in Single Text View – As like Twitter tweet

What you can do is create a Custom ClickableSpan as below, class MyCustomSpannable extends ClickableSpan { String Url; public MyCustomSpannable(String Url) { this.Url = Url; } @Override public void updateDrawState(TextPaint ds) { // Customize your Text Look if required ds.setColor(Color.YELLOW); ds.setFakeBoldText(true); ds.setStrikeThruText(true); ds.setTypeface(Typeface.SERIF); ds.setUnderlineText(true); ds.setShadowLayer(10, 1, 1, Color.WHITE); ds.setTextSize(15); } @Override public void onClick(View widget) … Read more

C# code to linkify urls in a string

It’s a pretty simple task you can acheive it with Regex and a ready-to-go regular expression from: http://regexlib.com/ Something like: var html = Regex.Replace(html, @”^(http|https|ftp)\://[a-zA-Z0-9\-\.]+” + “\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?” + “([a-zA-Z0-9\-\._\?\,\’/\\\+&amp;%\$#\=~])*$”, “<a href=\”$1\”>$1</a>”); You may also be interested not only in creating links but in shortening URLs. Here is a good article on this subject: Resolve and … Read more

Replace URLs in text with HTML links

Let’s look at the requirements. You have some user-supplied plain text, which you want to display with hyperlinked URLs. The “http://” protocol prefix should be optional. Both domains and IP addresses should be accepted. Any valid top-level domain should be accepted, e.g. .aero and .xn--jxalpdlp. Port numbers should be allowed. URLs must be allowed in … Read more