TextLinks.Apply(ISpannable, ApplyStrategy, IFunction) Method

Definition

Annotates the given text with the generated links.

[Android.Runtime.Register("apply", "(Landroid/text/Spannable;ILjava/util/function/Function;)I", "", ApiSince=28)]
public Android.Views.TextClassifiers.ApplyStatusCode Apply(Android.Text.ISpannable text, Android.Views.TextClassifiers.ApplyStrategy applyStrategy, Java.Util.Functions.IFunction? spanFactory);
[<Android.Runtime.Register("apply", "(Landroid/text/Spannable;ILjava/util/function/Function;)I", "", ApiSince=28)>]
member this.Apply : Android.Text.ISpannable * Android.Views.TextClassifiers.ApplyStrategy * Java.Util.Functions.IFunction -> Android.Views.TextClassifiers.ApplyStatusCode

Parameters

text
ISpannable

Spannable: the text to apply the links to. Must match the original text. This value cannot be null.

applyStrategy
ApplyStrategy

int: the apply strategy used to determine how to apply links to text. e.g TextLinks.APPLY_STRATEGY_IGNORE Value is one of the following: APPLY_STRATEGY_IGNORE APPLY_STRATEGY_REPLACE

spanFactory
IFunction

Function: a custom span factory for converting TextLinks to TextLinkSpans. Set to null to use the default span factory.

Returns

a status code indicating whether or not the links were successfully applied e.g. STATUS_LINKS_APPLIED Value is one of the following: STATUS_LINKS_APPLIED STATUS_NO_LINKS_FOUND STATUS_NO_LINKS_APPLIED STATUS_DIFFERENT_TEXT STATUS_UNSUPPORTED_CHARACTER

Attributes

Remarks

Annotates the given text with the generated links. It will fail if the provided text doesn't match the original text used to create the TextLinks. NOTE: It may be necessary to set a LinkMovementMethod on the TextView widget to properly handle links. See TextView.setMovementMethod(MovementMethod)

Android reference for android.view.textclassifier.TextLinks.apply.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to