# TtsSpan.FractionBuilder

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

# FractionBuilder

*** ** * ** ***

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

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

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

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

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Public constructors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#FractionBuilder())`()` Creates a builder for a TtsSpan of type[TYPE_FRACTION](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_FRACTION:kotlin.String).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#FractionBuilder(kotlin.Long,%20kotlin.Long,%20kotlin.Long))`(`integerPart:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `numerator:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `denominator:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Creates a TtsSpan of type[TYPE_FRACTION](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_FRACTION:kotlin.String)and sets the[ARG_INTEGER_PART](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_INTEGER_PART:kotlin.String),[ARG_NUMERATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_NUMERATOR:kotlin.String), and[ARG_DENOMINATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_DENOMINATOR:kotlin.String)arguments. |

|                                                                                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[TtsSpan.FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#)! | [setDenominator](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#setDenominator(kotlin.String))`(`denominator:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the[ARG_DENOMINATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_DENOMINATOR:kotlin.String)argument.                                                            |
| open[TtsSpan.FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#)! | [setDenominator](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#setDenominator(kotlin.Long))`(`denominator:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Convenience method that converts the denominator to a String and sets the argument[ARG_DENOMINATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_DENOMINATOR:kotlin.String). |
| open[TtsSpan.FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#)! | [setIntegerPart](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#setIntegerPart(kotlin.String))`(`integerPart:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the[ARG_INTEGER_PART](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_INTEGER_PART:kotlin.String)argument.                                                          |
| open[TtsSpan.FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#)! | [setIntegerPart](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#setIntegerPart(kotlin.Long))`(`integerPart:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Convenience method that converts the integer to a String and sets the argument[ARG_NUMBER](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_NUMBER:kotlin.String).               |
| open[TtsSpan.FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#)! | [setNumerator](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#setNumerator(kotlin.String))`(`numerator:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the[ARG_NUMERATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_NUMERATOR:kotlin.String)argument.                                                                      |
| open[TtsSpan.FractionBuilder](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#)! | [setNumerator](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan.FractionBuilder#setNumerator(kotlin.Long))`(`numerator:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Convenience method that converts the numerator to a String and sets the argument[ARG_NUMERATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_NUMERATOR:kotlin.String).             |

| 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

### FractionBuilder

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

```
FractionBuilder()
```

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

### FractionBuilder

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

```
FractionBuilder(
    integerPart: Long, 
    numerator: Long, 
    denominator: Long)
```

Creates a TtsSpan of type[TYPE_FRACTION](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#TYPE_FRACTION:kotlin.String)and sets the[ARG_INTEGER_PART](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_INTEGER_PART:kotlin.String),[ARG_NUMERATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_NUMERATOR:kotlin.String), and[ARG_DENOMINATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_DENOMINATOR:kotlin.String)arguments.

## Public methods

### setDenominator

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

```
open fun setDenominator(denominator: String!): TtsSpan.FractionBuilder!
```

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

|                                                                           Parameters                                                                           ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `denominator` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:A non-empty string of digits with an optional leading + or -. |

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

### setDenominator

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

```
open fun setDenominator(denominator: Long): TtsSpan.FractionBuilder!
```

Convenience method that converts the denominator to a String and sets the argument[ARG_DENOMINATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_DENOMINATOR:kotlin.String).

|                                                  Parameters                                                  ||
|---------------|-----------------------------------------------------------------------------------------------|
| `denominator` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The denominator. |

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

### setIntegerPart

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

```
open fun setIntegerPart(integerPart: String!): TtsSpan.FractionBuilder!
```

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

|                                                                           Parameters                                                                           ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `integerPart` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:A non-empty string of digits with an optional leading + or -. |

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

### setIntegerPart

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

```
open fun setIntegerPart(integerPart: Long): TtsSpan.FractionBuilder!
```

Convenience method that converts the integer to a String and sets the argument[ARG_NUMBER](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_NUMBER:kotlin.String).

|                                                  Parameters                                                   ||
|---------------|------------------------------------------------------------------------------------------------|
| `integerPart` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The integer part. |

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

### setNumerator

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

```
open fun setNumerator(numerator: String!): TtsSpan.FractionBuilder!
```

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

|                                                                          Parameters                                                                          ||
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `numerator` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:A non-empty string of digits with an optional leading + or -. |

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

### setNumerator

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

```
open fun setNumerator(numerator: Long): TtsSpan.FractionBuilder!
```

Convenience method that converts the numerator to a String and sets the argument[ARG_NUMERATOR](https://developer.android.com/reference/kotlin/android/text/style/TtsSpan#ARG_NUMERATOR:kotlin.String).

|                                                Parameters                                                ||
|-------------|---------------------------------------------------------------------------------------------|
| `numerator` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The numerator. |

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