URLSpan


public class URLSpan
extends ClickableSpan implements ParcelableSpan

java.lang.Object
   ↳ android.text.style.CharacterStyle
     ↳ android.text.style.ClickableSpan
       ↳ android.text.style.URLSpan


Implementation of the ClickableSpan that allows setting a url string. When selecting and clicking on the text to which the span is attached, the URLSpan will try to open the url, by launching an an Activity with an Intent.ACTION_VIEW intent.

For example, a URLSpan can be used like this:

 SpannableString string = new SpannableString("Text with a url span");
 string.setSpan(new URLSpan("http://www.developer.android.com"), 12, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
 
Text with URLSpan.

Summary

Inherited constants