# TextLinks.TextLinkSpan

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# TextLinkSpan

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/view/textclassifier/TextLinks.TextLinkSpan "View this page in Java")  

```
class TextLinkSpan : ClickableSpan
```

|---|---|---|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                 ||||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#)                                    |||
|   | ↳ | [android.text.style.ClickableSpan](https://developer.android.com/reference/kotlin/android/text/style/ClickableSpan.html#)                                   ||
|   |   | ↳ | [android.view.textclassifier.TextLinks.TextLinkSpan](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextLinks.TextLinkSpan#) |

A ClickableSpan for a TextLink.

Applies only to TextViews.

## Summary

|                                                                                                                                                      Public constructors                                                                                                                                                      ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [TextLinkSpan](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextLinks.TextLinkSpan#TextLinkSpan(android.view.textclassifier.TextLinks.TextLink))`(`textLink:` `[TextLinks.TextLink](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextLinks.TextLink)`)` <br /> |

|                                                                                                                                                                           Public methods                                                                                                                                                                           ||
|----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TextLinks.TextLink](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextLinks.TextLink)! | [getTextLink](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextLinks.TextLinkSpan#getTextLink())`()` <br />                                                                                                    |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                     | [onClick](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextLinks.TextLinkSpan#onClick(android.view.View))`(`widget:` `[View](https://developer.android.com/reference/kotlin/android/view/View.html#)`)` <br /> |

| Inherited functions ||
|---|---|
| From class[CharacterStyle](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#) |-----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [CharacterStyle](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#)! | [getUnderlying](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#getUnderlying())`()` <br /> Returns "this" for most CharacterStyles, but for CharacterStyles that were generated by[wrap](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#wrap(android.text.style.CharacterStyle)), returns the underlying CharacterStyle. <br />                                                                                                                                                                             | | [CharacterStyle](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#)! | [wrap](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#wrap(android.text.style.CharacterStyle))`(`cs:` `[CharacterStyle](https://developer.android.com/reference/kotlin/android/text/style/CharacterStyle.html#)!`)` <br /> 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. <br /> | ||
| From class[ClickableSpan](https://developer.android.com/reference/kotlin/android/text/style/ClickableSpan.html#) |----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](https://developer.android.com/reference/kotlin/android/text/style/ClickableSpan.html#toString())`()` <br />                                                                                                                                                                                             | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)     | [updateDrawState](https://developer.android.com/reference/kotlin/android/text/style/ClickableSpan.html#updateDrawState(android.text.TextPaint))`(`ds:` `[TextPaint](https://developer.android.com/reference/kotlin/android/text/TextPaint.html#)`)` <br /> Makes the text underlined and in the link color. <br /> | ||

## Public constructors

### TextLinkSpan

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
TextLinkSpan(textLink: TextLinks.TextLink)
```

|                                                                         Parameters                                                                          ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `textLink` | [TextLinks.TextLink](https://developer.android.com/reference/kotlin/android/view/textclassifier/TextLinks.TextLink):This value cannot be`null`. |

## Public methods

### getTextLink

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getTextLink(): TextLinks.TextLink!
```  

### onClick

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onClick(widget: View): Unit
```

|                                                      Parameters                                                      ||
|----------|------------------------------------------------------------------------------------------------------------|
| `widget` | [View](https://developer.android.com/reference/kotlin/android/view/View.html#):This value cannot be`null`. |