# LineBreakConfig.Builder

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

# LineBreakConfig.Builder

*** ** * ** ***

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

`
public
static
final

class
LineBreakConfig.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-----------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.text.LineBreakConfig.Builder |

<br />

*** ** * ** ***

A builder for creating a`LineBreakConfig`instance.

## Summary

|                                                          ### Public constructors                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder#Builder())`() ` Builder constructor. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ||
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[LineBreakConfig](https://developer.android.com/reference/android/graphics/text/LineBreakConfig)                 | ` `[build](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder#build())`() ` Builds a[LineBreakConfig](https://developer.android.com/reference/android/graphics/text/LineBreakConfig)instance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` `[LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | ` `[merge](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder#merge(android.graphics.text.LineBreakConfig))`(`[LineBreakConfig](https://developer.android.com/reference/android/graphics/text/LineBreakConfig)` config) ` Merges line break config with other config Update the internal configurations with passed`config`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` `[LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | ` `[setHyphenation](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder#setHyphenation(int))`(int hyphenation) ` Sets the hyphenation preference Note: Even if the[LineBreakConfig.HYPHENATION_ENABLED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#HYPHENATION_ENABLED)is specified, the hyphenation will not be performed if the[TextView](https://developer.android.com/reference/android/widget/TextView)or underlying[StaticLayout](https://developer.android.com/reference/android/text/StaticLayout),[LineBreaker](https://developer.android.com/reference/android/graphics/text/LineBreaker)are configured with[LineBreaker.HYPHENATION_FREQUENCY_NONE](https://developer.android.com/reference/android/graphics/text/LineBreaker#HYPHENATION_FREQUENCY_NONE). |
| ` `[LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | ` `[setLineBreakStyle](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder#setLineBreakStyle(int))`(int lineBreakStyle) ` Sets the line-break style.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | ` `[setLineBreakWordStyle](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder#setLineBreakWordStyle(int))`(int lineBreakWordStyle) ` Sets the line-break word style.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder ()
```

Builder constructor.

<br />

## Public methods

### build

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

```
public LineBreakConfig build ()
```

Builds a[LineBreakConfig](https://developer.android.com/reference/android/graphics/text/LineBreakConfig)instance. This method can be called multiple times for generating multiple[LineBreakConfig](https://developer.android.com/reference/android/graphics/text/LineBreakConfig)instances.

<br />

|                                                                              Returns                                                                               ||
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [LineBreakConfig](https://developer.android.com/reference/android/graphics/text/LineBreakConfig) | The`LineBreakConfig`instance. This value cannot be`null`. <br /> |

### merge

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

```
public LineBreakConfig.Builder merge (LineBreakConfig config)
```

Merges line break config with other config Update the internal configurations with passed`config`. If the config values of passed`config`are unspecified, the original config values are kept. For example, the following code passes`config`that has[LineBreakConfig.LINE_BREAK_STYLE_UNSPECIFIED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_UNSPECIFIED). This code generates[LineBreakConfig](https://developer.android.com/reference/android/graphics/text/LineBreakConfig)that has line break config[LineBreakConfig.LINE_BREAK_STYLE_STRICT](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_STRICT).  

```
     val override = LineBreakConfig.Builder()
          .setLineBreakWordStyle(LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE)
          .build();  // UNSPECIFIED if no setLineBreakStyle is called.
     val config = LineBreakConfig.Builder()
          .setLineBreakStyle(LineBreakConfig.LINE_BREAK_STYLE_STRICT)
          .merge(override)
          .build()
     // Here, config has LINE_BREAK_STYLE_STRICT of line break config and
     // LINE_BREAK_WORD_STYLE_PHRASE of line break word style.
 
```

<br />

<br />

|                                          Parameters                                           ||
|----------|-------------------------------------------------------------------------------------|
| `config` | `LineBreakConfig`: an override line break config This value cannot be`null`. <br /> |

|                                                                               Returns                                                                               ||
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | This`Builder`. This value cannot be`null`. <br /> |

**See also:**

- [LineBreakConfig.LINE_BREAK_STYLE_UNSPECIFIED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_UNSPECIFIED)
- [LineBreakConfig.LINE_BREAK_WORD_STYLE_UNSPECIFIED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_WORD_STYLE_UNSPECIFIED)  

### setHyphenation

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

```
public LineBreakConfig.Builder setHyphenation (int hyphenation)
```

Sets the hyphenation preference Note: Even if the[LineBreakConfig.HYPHENATION_ENABLED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#HYPHENATION_ENABLED)is specified, the hyphenation will not be performed if the[TextView](https://developer.android.com/reference/android/widget/TextView)or underlying[StaticLayout](https://developer.android.com/reference/android/text/StaticLayout),[LineBreaker](https://developer.android.com/reference/android/graphics/text/LineBreaker)are configured with[LineBreaker.HYPHENATION_FREQUENCY_NONE](https://developer.android.com/reference/android/graphics/text/LineBreaker#HYPHENATION_FREQUENCY_NONE). Note: Even if the hyphenation is enabled with a line break strategy[LineBreaker.BREAK_STRATEGY_SIMPLE](https://developer.android.com/reference/android/graphics/text/LineBreaker#BREAK_STRATEGY_SIMPLE), the hyphenation will not be performed unless a single word cannot meet width constraints.

<br />

|                                                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                                                ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `hyphenation` | `int`: The hyphenation preference. Value is[LineBreakConfig.HYPHENATION_UNSPECIFIED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#HYPHENATION_UNSPECIFIED),[LineBreakConfig.HYPHENATION_ENABLED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#HYPHENATION_ENABLED), or[LineBreakConfig.HYPHENATION_DISABLED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#HYPHENATION_DISABLED) <br /> |

|                                                                               Returns                                                                               ||
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | This`Builder`. This value cannot be`null`. <br /> |

### setLineBreakStyle

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

```
public LineBreakConfig.Builder setLineBreakStyle (int lineBreakStyle)
```

Sets the line-break style.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `lineBreakStyle` | `int`: The new line-break style. Value is[LineBreakConfig.LINE_BREAK_STYLE_NONE](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_NONE),[LineBreakConfig.LINE_BREAK_STYLE_LOOSE](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_LOOSE),[LineBreakConfig.LINE_BREAK_STYLE_NORMAL](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_NORMAL),[LineBreakConfig.LINE_BREAK_STYLE_STRICT](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_STRICT),[LineBreakConfig.LINE_BREAK_STYLE_UNSPECIFIED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_UNSPECIFIED),[LineBreakConfig.LINE_BREAK_STYLE_NO_BREAK](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_NO_BREAK), or[LineBreakConfig.LINE_BREAK_STYLE_AUTO](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_STYLE_AUTO) <br /> |

|                                                                               Returns                                                                               ||
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | This`Builder`. This value cannot be`null`. <br /> |

**See also:**

- [Unicode Line Break Style Identifier](https://unicode.org/reports/tr35/#UnicodeLineBreakStyleIdentifier)
- [CSS Line Break Property](https://drafts.csswg.org/css-text/#line-break-property)  

### setLineBreakWordStyle

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

```
public LineBreakConfig.Builder setLineBreakWordStyle (int lineBreakWordStyle)
```

Sets the line-break word style.

<br />

|                                                                                                                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                                                                                                                          ||
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `lineBreakWordStyle` | `int`: The new line-break word style. Value is[LineBreakConfig.LINE_BREAK_WORD_STYLE_NONE](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_WORD_STYLE_NONE),[LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_WORD_STYLE_PHRASE),[LineBreakConfig.LINE_BREAK_WORD_STYLE_UNSPECIFIED](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_WORD_STYLE_UNSPECIFIED), or[LineBreakConfig.LINE_BREAK_WORD_STYLE_AUTO](https://developer.android.com/reference/android/graphics/text/LineBreakConfig#LINE_BREAK_WORD_STYLE_AUTO) <br /> |

|                                                                               Returns                                                                               ||
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [LineBreakConfig.Builder](https://developer.android.com/reference/android/graphics/text/LineBreakConfig.Builder) | This`Builder`. This value cannot be`null`. <br /> |

**See also:**

- [Unicode Line Break Word Identifier](https://unicode.org/reports/tr35/#UnicodeLineBreakWordIdentifier)
- [CSS Word Break Property](https://drafts.csswg.org/css-text/#word-break-property)