# PrecomputedText.Params.Builder

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

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/text/PrecomputedText.Params.Builder "View this page in Java")  

```
class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                             ||
| ↳ | [android.text.PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#) |

A builder for creating[Params](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params).

## Summary

|                                                                                                                                                     Public constructors                                                                                                                                                     ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#Builder(android.text.PrecomputedText.Params))`(`params:` `[PrecomputedText.Params](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params)`)` Builder constructor from existing params. |
| [Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#Builder(android.text.TextPaint))`(`paint:` `[TextPaint](https://developer.android.com/reference/kotlin/android/text/TextPaint)`)` Builder constructor.                                                              |

|                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[PrecomputedText.Params](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params)                   | [build](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#build())`()` Build the[Params](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params).                                                                                                                                            |
| open[PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#)! | [setBreakStrategy](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#setBreakStrategy(kotlin.Int))`(`strategy:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the line break strategy.                                                                                              |
| open[PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#)! | [setHyphenationFrequency](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#setHyphenationFrequency(kotlin.Int))`(`frequency:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the hyphenation frequency.                                                                             |
| open[PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#)  | [setLineBreakConfig](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#setLineBreakConfig(android.graphics.text.LineBreakConfig))`(`lineBreakConfig:` `[LineBreakConfig](https://developer.android.com/reference/kotlin/android/graphics/text/LineBreakConfig.html#)`)` Set the line break config for the text wrapping. |
| open[PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#)! | [setTextDirection](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#setTextDirection(android.text.TextDirectionHeuristic))`(`textDir:` `[TextDirectionHeuristic](https://developer.android.com/reference/kotlin/android/text/TextDirectionHeuristic)`)` Set the text direction heuristic.                               |

## Public constructors

### Builder

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

```
Builder(params: PrecomputedText.Params)
```

Builder constructor from existing params.

|                                                                     Parameters                                                                     ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------|
| `params` | [PrecomputedText.Params](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params):This value cannot be`null`. |

### Builder

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

```
Builder(paint: TextPaint)
```

Builder constructor.

|                                                                        Parameters                                                                        ||
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `paint` | [TextPaint](https://developer.android.com/reference/kotlin/android/text/TextPaint):the paint to be used for drawing This value cannot be`null`. |

## Public methods

### build

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

```
open fun build(): PrecomputedText.Params
```

Build the[Params](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params).

|                                                                             Return                                                                             ||
|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| [PrecomputedText.Params](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params) | the layout parameter This value cannot be`null`. |

### setBreakStrategy

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

```
open fun setBreakStrategy(strategy: Int): PrecomputedText.Params.Builder!
```

Set the line break strategy. The default value is[Layout.BREAK_STRATEGY_HIGH_QUALITY](https://developer.android.com/reference/kotlin/android/text/Layout#BREAK_STRATEGY_HIGH_QUALITY:kotlin.Int).

|                                                                                                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                                                                                                         ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `strategy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the break strategy Value is[android.graphics.text.LineBreaker#BREAK_STRATEGY_SIMPLE](https://developer.android.com/reference/kotlin/android/graphics/text/LineBreaker.html#BREAK_STRATEGY_SIMPLE:kotlin.Int),[android.graphics.text.LineBreaker#BREAK_STRATEGY_HIGH_QUALITY](https://developer.android.com/reference/kotlin/android/graphics/text/LineBreaker.html#BREAK_STRATEGY_HIGH_QUALITY:kotlin.Int), or[android.graphics.text.LineBreaker#BREAK_STRATEGY_BALANCED](https://developer.android.com/reference/kotlin/android/graphics/text/LineBreaker.html#BREAK_STRATEGY_BALANCED:kotlin.Int) |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#)! | this builder, useful for chaining |

**See Also**

- [android.text.StaticLayout.Builder#setBreakStrategy](https://developer.android.com/reference/kotlin/android/text/StaticLayout.Builder#setBreakStrategy(kotlin.Int))
- [android.widget.TextView#setBreakStrategy](https://developer.android.com/reference/kotlin/android/widget/TextView.html#setBreakStrategy(kotlin.Int))  

### setHyphenationFrequency

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

```
open fun setHyphenationFrequency(frequency: Int): PrecomputedText.Params.Builder!
```

Set the hyphenation frequency. The default value is[Layout.HYPHENATION_FREQUENCY_NORMAL](https://developer.android.com/reference/kotlin/android/text/Layout#HYPHENATION_FREQUENCY_NORMAL:kotlin.Int).

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `frequency` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the hyphenation frequency Value is[android.text.Layout#HYPHENATION_FREQUENCY_NORMAL](https://developer.android.com/reference/kotlin/android/text/Layout#HYPHENATION_FREQUENCY_NORMAL:kotlin.Int),[android.text.Layout#HYPHENATION_FREQUENCY_NORMAL_FAST](https://developer.android.com/reference/kotlin/android/text/Layout#HYPHENATION_FREQUENCY_NORMAL_FAST:kotlin.Int),[android.text.Layout#HYPHENATION_FREQUENCY_FULL](https://developer.android.com/reference/kotlin/android/text/Layout#HYPHENATION_FREQUENCY_FULL:kotlin.Int),[android.text.Layout#HYPHENATION_FREQUENCY_FULL_FAST](https://developer.android.com/reference/kotlin/android/text/Layout#HYPHENATION_FREQUENCY_FULL_FAST:kotlin.Int), or[android.text.Layout#HYPHENATION_FREQUENCY_NONE](https://developer.android.com/reference/kotlin/android/text/Layout#HYPHENATION_FREQUENCY_NONE:kotlin.Int) |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#)! | this builder, useful for chaining |

**See Also**

- [android.text.StaticLayout.Builder#setHyphenationFrequency](https://developer.android.com/reference/kotlin/android/text/StaticLayout.Builder#setHyphenationFrequency(kotlin.Int))
- [android.widget.TextView#setHyphenationFrequency](https://developer.android.com/reference/kotlin/android/widget/TextView.html#setHyphenationFrequency(kotlin.Int))  

### setLineBreakConfig

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

```
open fun setLineBreakConfig(lineBreakConfig: LineBreakConfig): PrecomputedText.Params.Builder
```

Set the line break config for the text wrapping.

|                                                                                            Parameters                                                                                            ||
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `lineBreakConfig` | [LineBreakConfig](https://developer.android.com/reference/kotlin/android/graphics/text/LineBreakConfig.html#):the newly line break configuration. This value cannot be`null`. |

|                                                                                            Return                                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
| [PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#) | this builder, useful for chaining. This value cannot be`null`. |

**See Also**

- [android.text.StaticLayout.Builder#setLineBreakConfig](https://developer.android.com/reference/kotlin/android/text/StaticLayout.Builder#setLineBreakConfig(android.graphics.text.LineBreakConfig))  

### setTextDirection

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

```
open fun setTextDirection(textDir: TextDirectionHeuristic): PrecomputedText.Params.Builder!
```

Set the text direction heuristic. The default value is[TextDirectionHeuristics.FIRSTSTRONG_LTR](https://developer.android.com/reference/kotlin/android/text/TextDirectionHeuristics#FIRSTSTRONG_LTR:android.text.TextDirectionHeuristic).

|                                                                                                  Parameters                                                                                                  ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `textDir` | [TextDirectionHeuristic](https://developer.android.com/reference/kotlin/android/text/TextDirectionHeuristic):the text direction heuristic for resolving bidi behavior This value cannot be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [PrecomputedText.Params.Builder](https://developer.android.com/reference/kotlin/android/text/PrecomputedText.Params.Builder#)! | this builder, useful for chaining |

**See Also**

- [android.text.StaticLayout.Builder#setTextDirection](https://developer.android.com/reference/kotlin/android/text/StaticLayout.Builder#setTextDirection(android.text.TextDirectionHeuristic))