# DisplayCutout.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

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

A Builder class to construct a DisplayCutout instance.

Note that this is only for tests purpose. For production code, developers should always use a[DisplayCutout](https://developer.android.com/reference/kotlin/android/view/DisplayCutout)obtained from the system.

## Summary

|                                                              Public constructors                                                              ||
|--------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#Builder())`()` Begin building a DisplayCutout. |

|                                                                                                                                                                                                                                           Public methods                                                                                                                                                                                                                                           ||
|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DisplayCutout](https://developer.android.com/reference/kotlin/android/view/DisplayCutout)                  | [build](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#build())`()` Construct a new[DisplayCutout](https://developer.android.com/reference/kotlin/android/view/DisplayCutout)with the set parameters.                                                                                                                                              |
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | [setBoundingRectBottom](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#setBoundingRectBottom(android.graphics.Rect))`(`boundingRectBottom:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)`)` Set a bounding rectangle for a non-functional area on the display which is located on the bottom of the screen. |
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | [setBoundingRectLeft](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#setBoundingRectLeft(android.graphics.Rect))`(`boundingRectLeft:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)`)` Set a bounding rectangle for a non-functional area on the display which is located on the left of the screen.         |
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | [setBoundingRectRight](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#setBoundingRectRight(android.graphics.Rect))`(`boundingRectRight:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)`)` Set a bounding rectangle for a non-functional area on the display which is located on the right of the screen.     |
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | [setBoundingRectTop](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#setBoundingRectTop(android.graphics.Rect))`(`boundingRectTop:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)`)` Set a bounding rectangle for a non-functional area on the display which is located on the top of the screen.             |
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | [setCutoutPath](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#setCutoutPath(android.graphics.Path))`(`cutoutPath:` `[Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#)`)` Set the cutout[Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#).                                       |
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | [setSafeInsets](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#setSafeInsets(android.graphics.Insets))`(`safeInsets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Set the safe insets.                                                                                                              |
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | [setWaterfallInsets](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#setWaterfallInsets(android.graphics.Insets))`(`waterfallInsets:` `[Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#)`)` Set the waterfall insets of the DisplayCutout.                                                                     |

## Public constructors

### Builder

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

```
Builder()
```

Begin building a DisplayCutout.

## Public methods

### build

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

```
fun build(): DisplayCutout
```

Construct a new[DisplayCutout](https://developer.android.com/reference/kotlin/android/view/DisplayCutout)with the set parameters.

|                                                         Return                                                          ||
|--------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout](https://developer.android.com/reference/kotlin/android/view/DisplayCutout) | This value cannot be`null`. |

### setBoundingRectBottom

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

```
fun setBoundingRectBottom(boundingRectBottom: Rect): DisplayCutout.Builder
```

Set a bounding rectangle for a non-functional area on the display which is located on the bottom of the screen. If not set, the default value is an empty rectangle.

|                                                              Parameters                                                              ||
|----------------------|----------------------------------------------------------------------------------------------------------------|
| `boundingRectBottom` | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#):This value cannot be`null`. |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | This value cannot be`null`. |

### setBoundingRectLeft

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

```
fun setBoundingRectLeft(boundingRectLeft: Rect): DisplayCutout.Builder
```

Set a bounding rectangle for a non-functional area on the display which is located on the left of the screen. If not set, the default value is an empty rectangle.

|                                                             Parameters                                                             ||
|--------------------|----------------------------------------------------------------------------------------------------------------|
| `boundingRectLeft` | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#):This value cannot be`null`. |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | This value cannot be`null`. |

### setBoundingRectRight

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

```
fun setBoundingRectRight(boundingRectRight: Rect): DisplayCutout.Builder
```

Set a bounding rectangle for a non-functional area on the display which is located on the right of the screen. If not set, the default value is an empty rectangle.

|                                                             Parameters                                                              ||
|---------------------|----------------------------------------------------------------------------------------------------------------|
| `boundingRectRight` | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#):This value cannot be`null`. |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | This value cannot be`null`. |

### setBoundingRectTop

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

```
fun setBoundingRectTop(boundingRectTop: Rect): DisplayCutout.Builder
```

Set a bounding rectangle for a non-functional area on the display which is located on the top of the screen. If not set, the default value is an empty rectangle.

|                                                            Parameters                                                             ||
|-------------------|----------------------------------------------------------------------------------------------------------------|
| `boundingRectTop` | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#):This value cannot be`null`. |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | This value cannot be`null`. |

### setCutoutPath

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

```
fun setCutoutPath(cutoutPath: Path): DisplayCutout.Builder
```

Set the cutout[Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#). Note that not support creating/testing multiple display cutouts with setCutoutPath() in parallel.

|                                                          Parameters                                                          ||
|--------------|----------------------------------------------------------------------------------------------------------------|
| `cutoutPath` | [Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#):This value cannot be`null`. |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | This value cannot be`null`. |

### setSafeInsets

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

```
fun setSafeInsets(safeInsets: Insets): DisplayCutout.Builder
```

Set the safe insets. If not set, the default value is[Insets.NONE](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#NONE:android.graphics.Insets).

|                                                            Parameters                                                            ||
|--------------|--------------------------------------------------------------------------------------------------------------------|
| `safeInsets` | [Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):This value cannot be`null`. |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | This value cannot be`null`. |

### setWaterfallInsets

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

```
fun setWaterfallInsets(waterfallInsets: Insets): DisplayCutout.Builder
```

Set the waterfall insets of the DisplayCutout. If not set, the default value is[Insets.NONE](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#NONE:android.graphics.Insets)

|                                                              Parameters                                                               ||
|-------------------|--------------------------------------------------------------------------------------------------------------------|
| `waterfallInsets` | [Insets](https://developer.android.com/reference/kotlin/android/graphics/Insets.html#):This value cannot be`null`. |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [DisplayCutout.Builder](https://developer.android.com/reference/kotlin/android/view/DisplayCutout.Builder#) | This value cannot be`null`. |