# TtsSpan.TextBuilder

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

# TextBuilder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/text/style/TtsSpan.TextBuilder "View this page in Java")  

```
open class TextBuilder : TtsSpan.SemioticClassBuilder<TtsSpan.TextBuilder!>
```

|---|---|---|----------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                         ||||
| ↳ | [android.text.style.TtsSpan.Builder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.Builder)\<C\>           |||
|   | ↳ | [android.text.style.TtsSpan.SemioticClassBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.SemioticClassBuilder)\<[android.text.style.TtsSpan.TextBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#)\> ||
|   |   | ↳ | [android.text.style.TtsSpan.TextBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#) |

A builder for TtsSpans of type[TYPE_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_TEXT:kotlin.String).

## Summary

|                                                                                                                                                                                                                                            Public constructors                                                                                                                                                                                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [TextBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#TextBuilder())`()` Creates a builder for a TtsSpan of type[TYPE_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_TEXT:kotlin.String).                                                                                                                                                                                                                           |
| [TextBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#TextBuilder(kotlin.String))`(`text:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Creates a TtsSpan of type[TYPE_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_TEXT:kotlin.String)and sets the[ARG_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_TEXT:kotlin.String)argument. |

|                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                            ||
|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[TtsSpan.TextBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#)! | [setText](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#setText(kotlin.String))`(`text:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the[ARG_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_TEXT:kotlin.String)argument, the text to be synthesized. |

| Inherited functions ||
|---|---|
| From class[Builder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.Builder) |---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [TtsSpan](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan)! | [build](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.Builder#build())`()` <br /> Returns a TtsSpan built from the parameters set by the setter methods. <br />                                                                                                                                                                                                            | | C                                                                                     | [setIntArgument](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.Builder#setIntArgument(kotlin.String,%20kotlin.Int))`(`arg:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `value:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Sets an argument to an int value. <br />                   | | C                                                                                     | [setLongArgument](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.Builder#setLongArgument(kotlin.String,%20kotlin.Long))`(`arg:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `value:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` <br /> Sets an argument to a long value. <br />              | | C                                                                                     | [setStringArgument](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.Builder#setStringArgument(kotlin.String,%20kotlin.String))`(`arg:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `value:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> Sets an argument to a string value. <br /> | ||
| From class[SemioticClassBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.SemioticClassBuilder) |---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | C | [setAnimacy](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.SemioticClassBuilder#setAnimacy(kotlin.String))`(`animacy:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> Sets the animacy information for this instance. <br />                     | | C | [setCase](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.SemioticClassBuilder#setCase(kotlin.String))`(`grammaticalCase:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> Sets the grammatical case information for this instance. <br />          | | C | [setGender](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.SemioticClassBuilder#setGender(kotlin.String))`(`gender:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> Sets the gender information for this instance. <br />                         | | C | [setMultiplicity](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.SemioticClassBuilder#setMultiplicity(kotlin.String))`(`multiplicity:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> Sets the multiplicity information for this instance. <br /> | ||

## Public constructors

### TextBuilder

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

```
TextBuilder()
```

Creates a builder for a TtsSpan of type[TYPE_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_TEXT:kotlin.String).  

### TextBuilder

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

```
TextBuilder(text: String!)
```

Creates a TtsSpan of type[TYPE_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_TEXT:kotlin.String)and sets the[ARG_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_TEXT:kotlin.String)argument.

|                                                      Parameters                                                       ||
|--------|---------------------------------------------------------------------------------------------------------------|
| `text` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:The text to be synthesized. |

**See Also**

- [#setText(String)](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#setText(kotlin.String))

## Public methods

### setText

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

```
open fun setText(text: String!): TtsSpan.TextBuilder!
```

Sets the[ARG_TEXT](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_TEXT:kotlin.String)argument, the text to be synthesized.

|                                                           Parameters                                                           ||
|--------|------------------------------------------------------------------------------------------------------------------------|
| `text` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:The string that will be synthesized. |

|                                                             Return                                                             ||
|----------------------------------------------------------------------------------------------------------------|----------------|
| [TtsSpan.TextBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.TextBuilder#)! | This instance. |