Language

Linkify.AddLinks Method

Definition

Overloads

Name Description
AddLinks(ISpannable, Pattern, String, String[], Linkify+IMatchFilter, Linkify+ITransformFilter, IFunction)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(TextView, Pattern, String, String[], Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(ISpannable, Pattern, String, String[], Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(ISpannable, Pattern, String, Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(TextView, Pattern, String, Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(ISpannable, Pattern, String)

Applies a regex to a Spannable turning the matches into links.

AddLinks(ISpannable, MatchOptions, IFunction)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(TextView, MatchOptions)

Scans the text of the provided TextView and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(ISpannable, MatchOptions)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

AddLinks(TextView, Pattern, String)

Applies a regex to the text of a TextView turning the matches into links.

AddLinks(ISpannable, Pattern, String, String[], Linkify+IMatchFilter, Linkify+ITransformFilter, IFunction)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;[Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;Ljava/util/function/Function;)Z", "", ApiSince=29)]
public static bool AddLinks(Android.Text.ISpannable spannable, Java.Util.Regex.Pattern pattern, string? defaultScheme, string[]? schemes, Android.Text.Util.Linkify.IMatchFilter? matchFilter, Android.Text.Util.Linkify.ITransformFilter? transformFilter, Java.Util.Functions.IFunction? urlSpanFactory);
[<Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;[Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;Ljava/util/function/Function;)Z", "", ApiSince=29)>]
static member AddLinks : Android.Text.ISpannable * Java.Util.Regex.Pattern * string * string[] * Android.Text.Util.Linkify.IMatchFilter * Android.Text.Util.Linkify.ITransformFilter * Java.Util.Functions.IFunction -> bool

Parameters

spannable
ISpannable

spannable whose text is to be marked-up with links. This value cannot be null.

pattern
Pattern

regex pattern to be used for finding links. This value cannot be null.

defaultScheme
String

the default scheme to be prepended to links if the link does not start with one of the schemes given. This value may be null.

schemes
String[]

Additional recognized URL prefixes, such as http://. The default scheme is checked first, even if this array is null or empty. The default scheme is added only when no recognized prefix matches.

matchFilter
Linkify.IMatchFilter

the filter that is used to allow the client code additional control over which pattern matches are to be converted into links. This value may be null.

transformFilter
Linkify.ITransformFilter

filter to allow the client code to update the link found. This value may be null.

urlSpanFactory
IFunction

function used to create URLSpans. This value may be null.

Returns

True if at least one link is found and applied.

Attributes

Remarks

This overload uses the supplied regular expression, not a link-type mask. For each match, it calls the match filter first. Accepted text is passed to the transform filter before URL schemes are checked. A null filter skips that step.

The default scheme and additional schemes are converted to lowercase and checked in that order. Prefix checks ignore case; the first recognized prefix is normalized to lowercase. If none matches, the default scheme is added. A null or empty default scheme matches immediately as an empty prefix, so additional schemes are not checked.

The span factory receives the resulting URL and must return an URLSpan. If the factory is null, Android creates a standard URL span. The span covers the original matched range, not the length of the transformed URL.

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, int).

Android reference for android.text.util.Linkify.addLinks.

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

AddLinks(TextView, Pattern, String, String[], Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;Ljava/util/regex/Pattern;Ljava/lang/String;[Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)V", "", ApiSince=24)]
public static void AddLinks(Android.Widget.TextView text, Java.Util.Regex.Pattern pattern, string? defaultScheme, string[]? schemes, Android.Text.Util.Linkify.IMatchFilter? matchFilter, Android.Text.Util.Linkify.ITransformFilter? transformFilter);
[<Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;Ljava/util/regex/Pattern;Ljava/lang/String;[Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)V", "", ApiSince=24)>]
static member AddLinks : Android.Widget.TextView * Java.Util.Regex.Pattern * string * string[] * Android.Text.Util.Linkify.IMatchFilter * Android.Text.Util.Linkify.ITransformFilter -> unit

Parameters

text
TextView

Spannable whose text is to be marked-up with links

pattern
Pattern

Regex pattern to be used for finding links. This value cannot be null.

defaultScheme
String

The default scheme to be prepended to links if the link does not start with one of the schemes given. This value may be null.

schemes
String[]

Additional recognized URL prefixes, such as http://. The default scheme is checked first, even if this array is null or empty. The default scheme is added only when no recognized prefix matches.

matchFilter
Linkify.IMatchFilter

The filter that is used to allow the client code additional control over which pattern matches are to be converted into links. This value may be null.

transformFilter
Linkify.ITransformFilter

Filter to allow the client code to update the link found. This value may be null.

Attributes

Remarks

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, int).

Android reference for android.text.util.Linkify.addLinks.

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

AddLinks(ISpannable, Pattern, String, String[], Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;[Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)Z", "", ApiSince=24)]
public static bool AddLinks(Android.Text.ISpannable spannable, Java.Util.Regex.Pattern pattern, string? defaultScheme, string[]? schemes, Android.Text.Util.Linkify.IMatchFilter? matchFilter, Android.Text.Util.Linkify.ITransformFilter? transformFilter);
[<Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;[Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)Z", "", ApiSince=24)>]
static member AddLinks : Android.Text.ISpannable * Java.Util.Regex.Pattern * string * string[] * Android.Text.Util.Linkify.IMatchFilter * Android.Text.Util.Linkify.ITransformFilter -> bool

Parameters

spannable
ISpannable

Spannable whose text is to be marked-up with links. This value cannot be null.

pattern
Pattern

Regex pattern to be used for finding links. This value cannot be null.

defaultScheme
String

The default scheme to be prepended to links if the link does not start with one of the schemes given. This value may be null.

schemes
String[]

Additional recognized URL prefixes, such as http://. The default scheme is checked first, even if this array is null or empty. The default scheme is added only when no recognized prefix matches.

matchFilter
Linkify.IMatchFilter

The filter that is used to allow the client code additional control over which pattern matches are to be converted into links. This value may be null.

transformFilter
Linkify.ITransformFilter

Filter to allow the client code to update the link found. This value may be null.

Returns

True if at least one link is found and applied.

Attributes

Remarks

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, int).

Android reference for android.text.util.Linkify.addLinks.

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

AddLinks(ISpannable, Pattern, String, Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)Z", "")]
public static bool AddLinks(Android.Text.ISpannable spannable, Java.Util.Regex.Pattern pattern, string? scheme, Android.Text.Util.Linkify.IMatchFilter? matchFilter, Android.Text.Util.Linkify.ITransformFilter? transformFilter);
[<Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)Z", "")>]
static member AddLinks : Android.Text.ISpannable * Java.Util.Regex.Pattern * string * Android.Text.Util.Linkify.IMatchFilter * Android.Text.Util.Linkify.ITransformFilter -> bool

Parameters

spannable
ISpannable

Spannable whose text is to be marked-up with links. This value cannot be null.

pattern
Pattern

Regex pattern to be used for finding links. This value cannot be null.

scheme
String

Url scheme string (eg http:// to be prepended to the url of links that do not have a scheme specified in the link text

matchFilter
Linkify.IMatchFilter

The filter that is used to allow the client code additional control over which pattern matches are to be converted into links.

transformFilter
Linkify.ITransformFilter

Filter to allow the client code to update the link found. This value may be null.

Returns

True if at least one link is found and applied.

Attributes

Remarks

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, int).

Android reference for android.text.util.Linkify.addLinks.

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

AddLinks(TextView, Pattern, String, Linkify+IMatchFilter, Linkify+ITransformFilter)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;Ljava/util/regex/Pattern;Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)V", "")]
public static void AddLinks(Android.Widget.TextView text, Java.Util.Regex.Pattern pattern, string? scheme, Android.Text.Util.Linkify.IMatchFilter? matchFilter, Android.Text.Util.Linkify.ITransformFilter? transformFilter);
[<Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;Ljava/util/regex/Pattern;Ljava/lang/String;Landroid/text/util/Linkify$MatchFilter;Landroid/text/util/Linkify$TransformFilter;)V", "")>]
static member AddLinks : Android.Widget.TextView * Java.Util.Regex.Pattern * string * Android.Text.Util.Linkify.IMatchFilter * Android.Text.Util.Linkify.ITransformFilter -> unit

Parameters

text
TextView

Spannable whose text is to be marked-up with links

pattern
Pattern

Regex pattern to be used for finding links. This value cannot be null.

scheme
String

Url scheme string (eg http:// to be prepended to the url of links that do not have a scheme specified in the link text

matchFilter
Linkify.IMatchFilter

The filter that is used to allow the client code additional control over which pattern matches are to be converted into links.

transformFilter
Linkify.ITransformFilter

The filter that changes the accepted match text before its URL scheme is checked or added, or null to use the matched text unchanged.

Attributes

Remarks

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, int).

Android reference for android.text.util.Linkify.addLinks.

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

AddLinks(ISpannable, Pattern, String)

Applies a regex to a Spannable turning the matches into links.

[Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;)Z", "")]
public static bool AddLinks(Android.Text.ISpannable text, Java.Util.Regex.Pattern pattern, string? scheme);
[<Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;Ljava/util/regex/Pattern;Ljava/lang/String;)Z", "")>]
static member AddLinks : Android.Text.ISpannable * Java.Util.Regex.Pattern * string -> bool

Parameters

text
ISpannable

Spannable whose text is to be marked-up with links

pattern
Pattern

Regex pattern to be used for finding links

scheme
String

URL scheme string (eg http://) to be prepended to the links that do not start with this scheme.

Returns

True if at least one link is found and applied.

Attributes

Remarks

Applies a regex to a Spannable turning the matches into links.

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String).

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

AddLinks(ISpannable, MatchOptions, IFunction)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;ILjava/util/function/Function;)Z", "", ApiSince=29)]
public static bool AddLinks(Android.Text.ISpannable text, Android.Text.Util.MatchOptions mask, Java.Util.Functions.IFunction? urlSpanFactory);
[<Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;ILjava/util/function/Function;)Z", "", ApiSince=29)>]
static member AddLinks : Android.Text.ISpannable * Android.Text.Util.MatchOptions * Java.Util.Functions.IFunction -> bool

Parameters

text
ISpannable

Spannable whose text is to be marked-up with links

mask
MatchOptions

mask to define which kinds of links will be searched

urlSpanFactory
IFunction

function used to create URLSpans

Returns

True if at least one link is found and applied.

Attributes

Remarks

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links. If the mask is nonzero, it also removes any existing URLSpans attached to the Spannable, to avoid problems if you call it repeatedly on the same text.

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, int, java.util.function.Function<java.lang.String, android.text.style.URLSpan>).

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

AddLinks(TextView, MatchOptions)

Scans the text of the provided TextView and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;I)Z", "")]
public static bool AddLinks(Android.Widget.TextView text, Android.Text.Util.MatchOptions mask);
[<Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;I)Z", "")>]
static member AddLinks : Android.Widget.TextView * Android.Text.Util.MatchOptions -> bool

Parameters

text
TextView

TextView whose text is to be marked-up with links

mask
MatchOptions

Mask to define which kinds of links will be searched.

Returns

True if at least one link is found and applied.

Attributes

Remarks

Scans the text of the provided TextView and turns all occurrences of the link types indicated in the mask into clickable links. If matches are found the movement method for the TextView is set to LinkMovementMethod.

Java documentation for android.text.util.Linkify.addLinks(android.widget.TextView, int).

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

AddLinks(ISpannable, MatchOptions)

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.

[Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;I)Z", "")]
public static bool AddLinks(Android.Text.ISpannable text, Android.Text.Util.MatchOptions mask);
[<Android.Runtime.Register("addLinks", "(Landroid/text/Spannable;I)Z", "")>]
static member AddLinks : Android.Text.ISpannable * Android.Text.Util.MatchOptions -> bool

Parameters

text
ISpannable

Spannable whose text is to be marked-up with links

mask
MatchOptions

Mask to define which kinds of links will be searched.

Returns

True if at least one link is found and applied.

Attributes

Remarks

Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links. If the mask is nonzero, it also removes any existing URLSpans attached to the Spannable, to avoid problems if you call it repeatedly on the same text.

Java documentation for android.text.util.Linkify.addLinks(android.text.Spannable, int).

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

AddLinks(TextView, Pattern, String)

Applies a regex to the text of a TextView turning the matches into links.

[Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;Ljava/util/regex/Pattern;Ljava/lang/String;)V", "")]
public static void AddLinks(Android.Widget.TextView text, Java.Util.Regex.Pattern pattern, string? scheme);
[<Android.Runtime.Register("addLinks", "(Landroid/widget/TextView;Ljava/util/regex/Pattern;Ljava/lang/String;)V", "")>]
static member AddLinks : Android.Widget.TextView * Java.Util.Regex.Pattern * string -> unit

Parameters

text
TextView

TextView whose text is to be marked-up with links

pattern
Pattern

Regex pattern to be used for finding links

scheme
String

URL scheme string (eg http://) to be prepended to the links that do not start with this scheme.

Attributes

Remarks

Applies a regex to the text of a TextView turning the matches into links. If links are found then UrlSpans are applied to the link text match areas, and the movement method for the text is changed to LinkMovementMethod.

Java documentation for android.text.util.Linkify.addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String).

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