URLSpan
open class URLSpan : ClickableSpan, ParcelableSpan
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
Public constructors |
Constructs a URLSpan from a url string.
|
Constructs a URLSpan from a parcel.
|
Public methods |
open Int |
|
open Int |
|
open String! |
Get the url string for this span.
|
open Unit |
|
open String |
|
open Unit |
Flatten this object in to a Parcel.
|
Inherited functions |
From class CharacterStyle
CharacterStyle! |
getUnderlying()
Returns "this" for most CharacterStyles, but for CharacterStyles that were generated by wrap , returns the underlying CharacterStyle.
|
CharacterStyle! |
wrap(cs: CharacterStyle!)
A given CharacterStyle can only applied to a single region of a given Spanned. If you need to attach the same CharacterStyle to multiple regions, you can use this method to wrap it with a new object that will have the same effect but be a distinct object so that it can also be attached without conflict.
|
|
|
Public constructors
URLSpan
URLSpan(url: String!)
Constructs a URLSpan
from a url string.
Parameters |
url |
String!: the url string |
URLSpan
URLSpan(src: Parcel)
Constructs a URLSpan
from a parcel.
Parameters |
src |
Parcel: This value cannot be null . |
Public methods
describeContents
open fun describeContents(): Int
getSpanTypeId
open fun getSpanTypeId(): Int
getURL
open fun getURL(): String!
Get the url string for this span.
Return |
String! |
the url string. |
onClick
open fun onClick(widget: View): Unit
Parameters |
widget |
View: This value cannot be null . |
toString
open fun toString(): String
Return |
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.