# TtsSpan.DurationBuilder

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

# DurationBuilder

*** ** * ** ***

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

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

|---|---|---|------------------------------------------------------------------------------------------------------------------------------------------|
| [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.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#)\> ||
|   |   | ↳ | [android.text.style.TtsSpan.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#) |

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

## Summary

|                                                                                                                                         Public constructors                                                                                                                                          ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#DurationBuilder())`()` Creates a builder for a TtsSpan of type[TYPE_DURATION](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_DURATION:kotlin.String). |

|                                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[TtsSpan.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#) | [setHours](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#setHours(kotlin.Int))`(`hours:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the[ARG_HOURS](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_HOURS:kotlin.String)argument.           |
| open[TtsSpan.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#) | [setMinutes](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#setMinutes(kotlin.Int))`(`minutes:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the[ARG_MINUTES](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_MINUTES:kotlin.String)argument. |
| open[TtsSpan.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#) | [setSeconds](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#setSeconds(kotlin.Int))`(`seconds:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the[ARG_SECONDS](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_SECONDS:kotlin.String)argument. |

| 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

### DurationBuilder

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

```
DurationBuilder()
```

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

## Public methods

### setHours

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

```
open fun setHours(hours: Int): TtsSpan.DurationBuilder
```

Sets the[ARG_HOURS](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_HOURS:kotlin.String)argument.

|                                                     Parameters                                                     ||
|---------|-----------------------------------------------------------------------------------------------------------|
| `hours` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The value to be set for hours. |

|                                                                              Return                                                                               ||
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [TtsSpan.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#) | This instance. This value cannot be`null`. |

### setMinutes

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

```
open fun setMinutes(minutes: Int): TtsSpan.DurationBuilder
```

Sets the[ARG_MINUTES](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_MINUTES:kotlin.String)argument.

|                                                       Parameters                                                       ||
|-----------|-------------------------------------------------------------------------------------------------------------|
| `minutes` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The value to be set for minutes. |

|                                                                              Return                                                                               ||
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [TtsSpan.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#) | This instance. This value cannot be`null`. |

### setSeconds

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

```
open fun setSeconds(seconds: Int): TtsSpan.DurationBuilder
```

Sets the[ARG_SECONDS](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_SECONDS:kotlin.String)argument.

|                                                       Parameters                                                       ||
|-----------|-------------------------------------------------------------------------------------------------------------|
| `seconds` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The value to be set for seconds. |

|                                                                              Return                                                                               ||
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [TtsSpan.DurationBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.DurationBuilder#) | This instance. This value cannot be`null`. |