Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#inhmethods)

# TextLinks.Builder

*** ** * ** ***

` public static final class TextLinks.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.textclassifier.TextLinks.Builder |

<br />

*** ** * ** ***

A builder to construct a TextLinks instance.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#Builder(java.lang.String)(https://developer.android.com/reference/java/lang/String fullText) ` Create a new TextLinks.Builder. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#addLink(int,%20int,%20java.util.Map<java.lang.String,java.lang.Float>,%20android.os.Bundle)(int start, int end, https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/lang/Float> entityScores, https://developer.android.com/reference/android/os/Bundle extras) ` Adds a TextLink. |
| ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#addLink(int,%20int,%20java.util.Map<java.lang.String,java.lang.Float>)(int start, int end, https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/lang/Float> entityScores) ` Adds a TextLink. |
| ` https://developer.android.com/reference/android/view/textclassifier/TextLinks` | ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#build()() ` Constructs a TextLinks instance. |
| ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#clearTextLinks()() ` Removes all `https://developer.android.com/reference/android/view/textclassifier/TextLinks.TextLink`s. |
| ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | ` https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#setExtras(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle extras) ` Sets the extended data. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### Builder

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (String fullText)
```

Create a new TextLinks.Builder.

<br />

| Parameters ||
|---|---|
| `fullText` | `String`: The full text to annotate with links. This value cannot be `null`. <br /> |

## Public methods

### addLink

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextLinks.Builder addLink (int start, 
                int end, 
                Map<String, Float> entityScores, 
                Bundle extras)
```

Adds a TextLink.

<br />

| Parameters ||
|---|---|
| `start` | `int` <br /> |
| `end` | `int` <br /> |
| `entityScores` | `Map`: This value cannot be `null`. <br /> |
| `extras` | `Bundle`: An optional bundle containing custom data related to this TextLink. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder#addLink(int,%20int,%20java.util.Map<java.lang.String,java.lang.Float>)`

### addLink

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextLinks.Builder addLink (int start, 
                int end, 
                Map<String, Float> entityScores)
```

Adds a TextLink.

<br />

| Parameters ||
|---|---|
| `start` | `int`: The start index of the identified subsequence <br /> |
| `end` | `int`: The end index of the identified subsequence <br /> |
| `entityScores` | `Map`: A mapping of entity type to confidence score. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if entityScores is null or empty. |

### build

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextLinks build ()
```

Constructs a TextLinks instance.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLinks` | the constructed TextLinks. This value cannot be `null`. <br /> |

### clearTextLinks

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextLinks.Builder clearTextLinks ()
```

Removes all `https://developer.android.com/reference/android/view/textclassifier/TextLinks.TextLink`s.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | This value cannot be `null`. <br /> |

### setExtras

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TextLinks.Builder setExtras (Bundle extras)
```

Sets the extended data.

<br />

| Parameters ||
|---|---|
| `extras` | `Bundle`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textclassifier/TextLinks.Builder` | this builder. This value cannot be `null`. <br /> |