public class

TextLinks.DefaultTextLinkSpan

extends TextLinks.TextLinkSpan

 java.lang.Object

↳ClickableSpan

androidx.textclassifier.TextLinks.TextLinkSpan

↳androidx.textclassifier.TextLinks.DefaultTextLinkSpan

Overview

The default implementation of TextLinks.TextLinkSpan.

When this span is clicked, text classifier will be used to classify the text in the span and suggest possible actions. The suggested actions will be presented to users eventually. You can change the way how the suggested actions are presented to user by overriding TextLinks.DefaultTextLinkSpan.onTextClassificationResult(TextView, TextClassification).

Summary

Constructors
publicDefaultTextLinkSpan(TextLinks.TextLinkSpanData textLinkSpanData)

Constructs a DefaultTextLinkSpan.

Methods
public voidonClick(View widget)

Performs the click action associated with this span.

public voidonTextClassificationResult(TextView textView, TextClassification textClassification)

Invoked when the classification of the text of this span is available.

from TextLinks.TextLinkSpangetTextLinkSpanData
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public DefaultTextLinkSpan(TextLinks.TextLinkSpanData textLinkSpanData)

Constructs a DefaultTextLinkSpan.

Parameters:

textLinkSpanData: The data object that contains data of this span, like the text link.

Methods

public void onClick(View widget)

Performs the click action associated with this span.

Subclass implementations should always call through to the superclass implementation.

public void onTextClassificationResult(TextView textView, TextClassification textClassification)

Invoked when the classification of the text of this span is available.

When user clicks on this span, text classifier will be used to classify the text of this span. Once text classifier has the result, this callback will be invoked. If the text in the textview is changed during the text classification, this won't be invoked.

You can change the way how the suggested actions are presented to user by overriding this function.

Parameters:

textView: the textview that this span is attached to
textClassification: the text classification result of the text in this span.