# ActivityRule.Builder

# ActivityRule.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/ActivityRule.kt+class:androidx.window.embedding.ActivityRule.Builder)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/window#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/window/embedding/ActivityRule.Builder "View this page in Java")

<br />

```
class ActivityRule.Builder
```

<br />

*** ** * ** ***

Builder for[ActivityRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule).

## Summary

|                                                                                                                                                                   ### Public constructors                                                                                                                                                                   |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule.Builder#Builder(kotlin.collections.Set))`(filters: `[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[ActivityFilter](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityFilter)`>)` |

|                                                 ### Public functions                                                  |
|-----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ActivityRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule)                 | [build](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule.Builder#build())`()` Builds an`ActivityRule`instance.                                                                                                                                                                                                                                             |
| [ActivityRule.Builder](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule.Builder) | [setAlwaysExpand](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule.Builder#setAlwaysExpand(kotlin.Boolean))`(alwaysExpand: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Sets whether the activity should always be expanded on launch.                                                                          |
| [ActivityRule.Builder](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule.Builder) | [setTag](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule.Builder#setTag(kotlin.String))`(tag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Sets a unique string to identify this[ActivityRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule), which defaults to`null`. |

## Public constructors

### Builder

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

```
Builder(filters: Set<ActivityFilter>)
```  

|                                                                                                    Parameters                                                                                                     |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| `filters: `[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[ActivityFilter](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityFilter)`>` | See[ActivityRule.filters](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule#filters()). |

## Public functions

### build

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

```
fun build(): ActivityRule
```

Builds an`ActivityRule`instance.  

|                                                Returns                                                |
|-------------------------------------------------------------------------------------------------------|--------------------------------|
| [ActivityRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule) | The new`ActivityRule`instance. |

### setAlwaysExpand

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

```
fun setAlwaysExpand(alwaysExpand: Boolean): ActivityRule.Builder
```

Sets whether the activity should always be expanded on launch. Some activities are supposed to expand to the full task bounds, independent of the state of the split. An example is an activity that blocks all user interactions, such as a warning dialog.  

|                                             Parameters                                              |
|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `alwaysExpand: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the activity should always be expanded on launch. |

### setTag

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

```
fun setTag(tag: String?): ActivityRule.Builder
```

Sets a unique string to identify this[ActivityRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule), which defaults to`null`.  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| `tag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | unique string to identify this[ActivityRule](https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityRule). |