# SplitPlaceholderRule.Builder

Artifact: [androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/embedding/SplitPlaceholderRule.kt+class:androidx.window.embedding.SplitPlaceholderRule.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

*** ** * ** ***


```
public final class SplitPlaceholderRule.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#Builder(kotlin.collections.Set,android.content.Intent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/ActivityFilter> filters, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html placeholderIntent )` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#build()()` Builds a `SplitPlaceholderRule` instance. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setDefaultSplitAttributes(androidx.window.embedding.SplitAttributes)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes defaultSplitAttributes )` Sets the default `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes` to apply on the activity containers pair when the host task bounds satisfy `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#minWidthDp()`, `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#minHeightDp()`, `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#minSmallestWidthDp()`, `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#maxAspectRatioInPortrait()` and `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#maxAspectRatioInLandscape()` requirements. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setFinishPrimaryWithPlaceholder(androidx.window.embedding.SplitRule.FinishBehavior)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitRule.FinishBehavior finishPrimaryWithPlaceholder )` Sets the behavior of the primary container when all activities are finished in the associated placeholder container. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setMaxAspectRatioInLandscape(androidx.window.embedding.EmbeddingAspectRatio)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio aspectRatio)` Sets the largest value of the aspect ratio, expressed as `width / height` in decimal form, of the parent window bounds in landscape when the split should be used. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setMaxAspectRatioInPortrait(androidx.window.embedding.EmbeddingAspectRatio)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio aspectRatio)` Sets the largest value of the aspect ratio, expressed as `height / width` in decimal form, of the parent window bounds in portrait when the split should be used. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setMinHeightDp(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int minHeightDp)` Sets the smallest value of height of the parent task window when the split should be used, in DP. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setMinSmallestWidthDp(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int minSmallestWidthDp)` Sets the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setMinWidthDp(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int minWidthDp)` Sets the smallest value of width of the parent window when the split should be used, in DP. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setSticky(kotlin.Boolean)(boolean isSticky)` Sets whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder` | `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#setTag(kotlin.String)(https://developer.android.com/reference/java/lang/String.html tag)` Sets a unique string to identify this `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule`, which defaults to `null`. |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public Builder(
    @NonNull Set<@NonNull ActivityFilter> filters,
    @NonNull Intent placeholderIntent
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/ActivityFilter> filters` | Filters used to choose when to apply this rule. The rule may be used if any one of the provided filters matches. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html placeholderIntent` | Intent to launch the placeholder activity. |

## Public methods

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule build()
```

Builds a `SplitPlaceholderRule` instance.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule` | The new `SplitPlaceholderRule` instance. |

### setDefaultSplitAttributes

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setDefaultSplitAttributes(
    @NonNull SplitAttributes defaultSplitAttributes
)
```

Sets the default `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes` to apply on the activity containers pair when the host task bounds satisfy `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#minWidthDp()`, `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#minHeightDp()`, `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#minSmallestWidthDp()`, `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#maxAspectRatioInPortrait()` and `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule.Builder#maxAspectRatioInLandscape()` requirements.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitAttributes defaultSplitAttributes` | the default `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes` to apply on the activity containers pair when the host task bounds satisfy all the rule requirements. |

### setFinishPrimaryWithPlaceholder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setFinishPrimaryWithPlaceholder(
    @NonNull SplitRule.FinishBehavior finishPrimaryWithPlaceholder
)
```

Sets the behavior of the primary container when all activities are finished in the associated placeholder container.

**Note** that it is not valid to set `https://developer.android.com/reference/androidx/window/embedding/SplitRule.FinishBehavior#NEVER()`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/SplitRule.FinishBehavior finishPrimaryWithPlaceholder` | the `https://developer.android.com/reference/androidx/window/embedding/SplitRule.FinishBehavior` of the primary container when all activities are finished in the associated placeholder container. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/SplitRule.FinishBehavior#ALWAYS()` |   |
| `https://developer.android.com/reference/androidx/window/embedding/SplitRule.FinishBehavior#ADJACENT()` |   |

### setMaxAspectRatioInLandscape

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setMaxAspectRatioInLandscape(@NonNull EmbeddingAspectRatio aspectRatio)
```

Sets the largest value of the aspect ratio, expressed as `width / height` in decimal form, of the parent window bounds in landscape when the split should be used. When the window aspect ratio is greater than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.

This value is only used when the parent window is in landscape (width \> height).

The default is `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MAX_ASPECT_RATIO_LANDSCAPE_DEFAULT()` if the app doesn't set, which is the recommend value to always allow split when the parent window is in landscape.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio aspectRatio` | the largest value of the aspect ratio, expressed as `width / height` in decimal form, of the parent window bounds in landscape when the split should be used. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ratio(kotlin.Float)` |   |
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_ALLOW()` |   |
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_DISALLOW()` |   |

### setMaxAspectRatioInPortrait

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setMaxAspectRatioInPortrait(@NonNull EmbeddingAspectRatio aspectRatio)
```

Sets the largest value of the aspect ratio, expressed as `height / width` in decimal form, of the parent window bounds in portrait when the split should be used. When the window aspect ratio is greater than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.

This value is only used when the parent window is in portrait (height \>= width).

The default is `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MAX_ASPECT_RATIO_PORTRAIT_DEFAULT()` if the app doesn't set, which is the recommend value to only allow split when the parent window is not too stretched in portrait.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio aspectRatio` | the largest value of the aspect ratio, expressed as `height / width` in decimal form, of the parent window bounds in portrait when the split should be used. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ratio(kotlin.Float)` |   |
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_ALLOW()` |   |
| `https://developer.android.com/reference/androidx/window/embedding/EmbeddingAspectRatio#ALWAYS_DISALLOW()` |   |

### setMinHeightDp

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setMinHeightDp(@IntRange(from = 0) int minHeightDp)
```

Sets the smallest value of height of the parent task window when the split should be used, in DP. When the window size is smaller than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.

It is useful if it's necessary to split the parent window horizontally for this `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule`.

The default is `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MIN_DIMENSION_DP_DEFAULT()` if the app doesn't set. `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MIN_DIMENSION_ALWAYS_ALLOW()` means to always allow split.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int minHeightDp` | the smallest value of height of the parent task window when the split should be used, in DP. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.LayoutDirection#TOP_TO_BOTTOM()` |   |
| `https://developer.android.com/reference/androidx/window/embedding/SplitAttributes.LayoutDirection#BOTTOM_TO_TOP()` |   |

### setMinSmallestWidthDp

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setMinSmallestWidthDp(@IntRange(from = 0) int minSmallestWidthDp)
```

Sets the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP. When the window size is smaller than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.

The default is `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MIN_DIMENSION_DP_DEFAULT()` if the app doesn't set. `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MIN_DIMENSION_ALWAYS_ALLOW()` means to always allow split.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int minSmallestWidthDp` | the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP. |

### setMinWidthDp

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setMinWidthDp(@IntRange(from = 0) int minWidthDp)
```

Sets the smallest value of width of the parent window when the split should be used, in DP. When the window size is smaller than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.

The default is `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MIN_DIMENSION_DP_DEFAULT()` if the app doesn't set. `https://developer.android.com/reference/androidx/window/embedding/SplitRule#SPLIT_MIN_DIMENSION_ALWAYS_ALLOW()` means to always allow split.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int minWidthDp` | the smallest value of width of the parent window when the split should be used, in DP. |

### setSticky

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setSticky(boolean isSticky)
```

Sets whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width.

| Parameters |
|---|---|
| `boolean isSticky` | whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width. |

### setTag

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

```
public final @NonNull SplitPlaceholderRule.Builder setTag(String tag)
```

Sets a unique string to identify this `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule`, which defaults to `null`. The suggested usage is to set the tag to be able to differentiate between different rules in the `https://developer.android.com/reference/androidx/window/embedding/SplitAttributesCalculatorParams#splitRuleTag()`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html tag` | unique string to identify this `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule`. |