# LinkifyCompat

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#)  

# LinkifyCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
LinkifyCompat
`  
`

extends Object


``


`

|---|--------------------------------------------|
| java.lang.Object                              ||
| ↳ | android.support.v4.text.util.LinkifyCompat |

<br />

*** ** * ** ***

LinkifyCompat brings in`Linkify`improvements for URLs and email addresses to older API levels.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                                                                                                                                                                                          ||
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static void`    | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter))`(`[TextView](https://developer.android.com/reference/android/widget/TextView.html)` text, Pattern pattern, String scheme, `[Linkify.MatchFilter](https://developer.android.com/reference/android/text/util/Linkify.MatchFilter.html)` matchFilter, `[Linkify.TransformFilter](https://developer.android.com/reference/android/text/util/Linkify.TransformFilter.html)` transformFilter) ` Applies a regex to the text of a TextView turning the matches into links.                                              |
| ` static void`    | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter))`(`[TextView](https://developer.android.com/reference/android/widget/TextView.html)` text, Pattern pattern, String defaultScheme, String[] schemes, `[Linkify.MatchFilter](https://developer.android.com/reference/android/text/util/Linkify.MatchFilter.html)` matchFilter, `[Linkify.TransformFilter](https://developer.android.com/reference/android/text/util/Linkify.TransformFilter.html)` transformFilter) ` Applies a regex to the text of a TextView turning the matches into links. |
| ` static boolean` | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter))`(`[Spannable](https://developer.android.com/reference/android/text/Spannable.html)` spannable, Pattern pattern, String defaultScheme, String[] schemes, `[Linkify.MatchFilter](https://developer.android.com/reference/android/text/util/Linkify.MatchFilter.html)` matchFilter, `[Linkify.TransformFilter](https://developer.android.com/reference/android/text/util/Linkify.TransformFilter.html)` transformFilter) ` Applies a regex to a Spannable turning the matches into links.        |
| ` static boolean` | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String))`(`[Spannable](https://developer.android.com/reference/android/text/Spannable.html)` text, Pattern pattern, String scheme) ` Applies a regex to a Spannable turning the matches into links.                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` static boolean` | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.text.Spannable, int))`(`[Spannable](https://developer.android.com/reference/android/text/Spannable.html)` text, int mask) ` Scans the text of the provided Spannable and turns all occurrences of the link types indicated in the mask into clickable links.                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` static void`    | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.widget.TextView, java.util.regex.Pattern, java.lang.String))`(`[TextView](https://developer.android.com/reference/android/widget/TextView.html)` text, Pattern pattern, String scheme) ` Applies a regex to the text of a TextView turning the matches into links.                                                                                                                                                                                                                                                                                                                                                                                              |
| ` static boolean` | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter))`(`[Spannable](https://developer.android.com/reference/android/text/Spannable.html)` spannable, Pattern pattern, String scheme, `[Linkify.MatchFilter](https://developer.android.com/reference/android/text/util/Linkify.MatchFilter.html)` matchFilter, `[Linkify.TransformFilter](https://developer.android.com/reference/android/text/util/Linkify.TransformFilter.html)` transformFilter) ` Applies a regex to a Spannable turning the matches into links.                                                     |
| ` static boolean` | ` `[addLinks](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#addLinks(android.widget.TextView, int))`(`[TextView](https://developer.android.com/reference/android/widget/TextView.html)` text, int mask) ` Scans the text of the provided TextView and turns all occurrences of the link types indicated in the mask into clickable links.                                                                                                                                                                                                                                                                                                                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void addLinks (TextView text, 
                Pattern pattern, 
                String scheme, 
                Linkify.MatchFilter matchFilter, 
                Linkify.TransformFilter transformFilter)
```

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.

<br />

|                                                                                   Parameters                                                                                    ||
|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`            | `TextView`: TextView whose text is to be marked-up with links <br />                                                                                         |
| `pattern`         | `Pattern`: Regex pattern to be used for finding links <br />                                                                                                 |
| `scheme`          | `String`: URL scheme string (eg`http://`) to be prepended to the links that do not start with this scheme. <br />                                            |
| `matchFilter`     | `Linkify.MatchFilter`: The filter that is used to allow the client code additional control over which pattern matches are to be converted into links. <br /> |
| `transformFilter` | `Linkify.TransformFilter` <br />                                                                                                                             |

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void addLinks (TextView text, 
                Pattern pattern, 
                String defaultScheme, 
                String[] schemes, 
                Linkify.MatchFilter matchFilter, 
                Linkify.TransformFilter transformFilter)
```

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.

<br />

|                                                                                        Parameters                                                                                        ||
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `text`            | `TextView`: TextView whose text is to be marked-up with links. <br />                                                                                                 |
| `pattern`         | `Pattern`: Regex pattern to be used for finding links. <br />                                                                                                         |
| `defaultScheme`   | `String`: The default scheme to be prepended to links if the link does not start with one of the`schemes`given. <br />                                                |
| `schemes`         | `String`: Array of schemes (eg`http://`) to check if the link found contains a scheme. Passing a null or empty value means prepend defaultScheme to all links. <br /> |
| `matchFilter`     | `Linkify.MatchFilter`: The filter that is used to allow the client code additional control over which pattern matches are to be converted into links. <br />          |
| `transformFilter` | `Linkify.TransformFilter`: Filter to allow the client code to update the link found. <br />                                                                           |

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean addLinks (Spannable spannable, 
                Pattern pattern, 
                String defaultScheme, 
                String[] schemes, 
                Linkify.MatchFilter matchFilter, 
                Linkify.TransformFilter transformFilter)
```

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

<br />

|                                                                                        Parameters                                                                                        ||
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `spannable`       | `Spannable`: Spannable whose text is to be marked-up with links. <br />                                                                                               |
| `pattern`         | `Pattern`: Regex pattern to be used for finding links. <br />                                                                                                         |
| `defaultScheme`   | `String`: The default scheme to be prepended to links if the link does not start with one of the`schemes`given. <br />                                                |
| `schemes`         | `String`: Array of schemes (eg`http://`) to check if the link found contains a scheme. Passing a null or empty value means prepend defaultScheme to all links. <br /> |
| `matchFilter`     | `Linkify.MatchFilter`: The filter that is used to allow the client code additional control over which pattern matches are to be converted into links. <br />          |
| `transformFilter` | `Linkify.TransformFilter`: Filter to allow the client code to update the link found. <br />                                                                           |

|                              Returns                              ||
|-----------|--------------------------------------------------------|
| `boolean` | True if at least one link is found and applied. <br /> |

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean addLinks (Spannable text, 
                Pattern pattern, 
                String scheme)
```

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

<br />

|                                                          Parameters                                                          ||
|-----------|-------------------------------------------------------------------------------------------------------------------|
| `text`    | `Spannable`: Spannable whose text is to be marked-up with links <br />                                            |
| `pattern` | `Pattern`: Regex pattern to be used for finding links <br />                                                      |
| `scheme`  | `String`: URL scheme string (eg`http://`) to be prepended to the links that do not start with this scheme. <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean addLinks (Spannable text, 
                int mask)
```

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.

<br />

|                                   Parameters                                   ||
|--------|------------------------------------------------------------------------|
| `text` | `Spannable`: Spannable whose text is to be marked-up with links <br /> |
| `mask` | `int`: Mask to define which kinds of links will be searched. <br />    |

|                              Returns                              ||
|-----------|--------------------------------------------------------|
| `boolean` | True if at least one link is found and applied. <br /> |

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void addLinks (TextView text, 
                Pattern pattern, 
                String scheme)
```

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.

<br />

|                                                          Parameters                                                          ||
|-----------|-------------------------------------------------------------------------------------------------------------------|
| `text`    | `TextView`: TextView whose text is to be marked-up with links <br />                                              |
| `pattern` | `Pattern`: Regex pattern to be used for finding links <br />                                                      |
| `scheme`  | `String`: URL scheme string (eg`http://`) to be prepended to the links that do not start with this scheme. <br /> |

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean addLinks (Spannable spannable, 
                Pattern pattern, 
                String scheme, 
                Linkify.MatchFilter matchFilter, 
                Linkify.TransformFilter transformFilter)
```

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

<br />

|                                                                                   Parameters                                                                                    ||
|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `spannable`       | `Spannable`: Spannable whose text is to be marked-up with links <br />                                                                                       |
| `pattern`         | `Pattern`: Regex pattern to be used for finding links <br />                                                                                                 |
| `scheme`          | `String`: URL scheme string (eg`http://`) to be prepended to the links that do not start with this scheme. <br />                                            |
| `matchFilter`     | `Linkify.MatchFilter`: The filter that is used to allow the client code additional control over which pattern matches are to be converted into links. <br /> |
| `transformFilter` | `Linkify.TransformFilter`: Filter to allow the client code to update the link found. <br />                                                                  |

|                              Returns                              ||
|-----------|--------------------------------------------------------|
| `boolean` | True if at least one link is found and applied. <br /> |

### addLinks

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean addLinks (TextView text, 
                int mask)
```

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.

<br />

|                                  Parameters                                  ||
|--------|----------------------------------------------------------------------|
| `text` | `TextView`: TextView whose text is to be marked-up with links <br /> |
| `mask` | `int`: Mask to define which kinds of links will be searched. <br />  |

|                              Returns                              ||
|-----------|--------------------------------------------------------|
| `boolean` | True if at least one link is found and applied. <br /> |

-

  ## Classes

  - [LinkifyCompat](https://developer.android.com/reference/android/support/v4/text/util/LinkifyCompat)