Stay organized with collections
Save and categorize content based on your preferences.
Linkify.MatchFilter
public
static
interface
Linkify.MatchFilter
android.text.util.Linkify.MatchFilter
|
MatchFilter enables client code to have more control over
what is allowed to match and become a link, and what is not.
For example: when matching web URLs you would like things like
http://www.example.com to match, as well as just example.com itelf.
However, you would not want to match against the domain in
support@example.com. So, when matching against a web URL pattern you
might also include a MatchFilter that disallows the match if it is
immediately preceded by an at-sign (@).
Summary
Public methods |
abstract
boolean
|
acceptMatch(CharSequence s, int start, int end)
Examines the character span matched by the pattern and determines
if the match should be turned into an actionable link.
|
Public methods
acceptMatch
public abstract boolean acceptMatch (CharSequence s,
int start,
int end)
Examines the character span matched by the pattern and determines
if the match should be turned into an actionable link.
Parameters |
s |
CharSequence : The body of text against which the pattern
was matched |
start |
int : The index of the first character in s that was
matched by the pattern - inclusive |
end |
int : The index of the last character in s that was
matched - exclusive |
Returns |
boolean |
Whether this match should be turned into a link |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Linkify.MatchFilter\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nLinkify.MatchFilter\n===================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/text/util/Linkify.MatchFilter \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nLinkify.MatchFilter\n`\n\n\n`\n\n\n`\n\n|---------------------------------------|\n| android.text.util.Linkify.MatchFilter |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nMatchFilter enables client code to have more control over\nwhat is allowed to match and become a link, and what is not.\n\nFor example: when matching web URLs you would like things like\nhttp://www.example.com to match, as well as just example.com itelf.\nHowever, you would not want to match against the domain in\nsupport@example.com. So, when matching against a web URL pattern you\nmight also include a MatchFilter that disallows the match if it is\nimmediately preceded by an at-sign (@).\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[acceptMatch](/reference/android/text/util/Linkify.MatchFilter#acceptMatch(java.lang.CharSequence,%20int,%20int))`(`[CharSequence](/reference/java/lang/CharSequence)` s, int start, int end) ` Examines the character span matched by the pattern and determines if the match should be turned into an actionable link. |\n\nPublic methods\n--------------\n\n### acceptMatch\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean acceptMatch (CharSequence s, \n int start, \n int end)\n```\n\nExamines the character span matched by the pattern and determines\nif the match should be turned into an actionable link.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|-------------------------------------------------------------------------------------------------|\n| `s` | `CharSequence`: The body of text against which the pattern was matched \u003cbr /\u003e |\n| `start` | `int`: The index of the first character in s that was matched by the pattern - inclusive \u003cbr /\u003e |\n| `end` | `int`: The index of the last character in s that was matched - exclusive \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------------------------|\n| `boolean` | Whether this match should be turned into a link \u003cbr /\u003e |"]]