---
title: "SpatialActivityPanel"
description: "Creates a [SpatialActivityPanel] that launches and displays an Activity within it."
type: "composable"
lastmod: "2026-09-24"
---
## API Reference

### SpatialActivityPanel

> Source set: Android

```kotlin
@Composable
public fun SpatialActivityPanel(
    controller: SpatialActivityPanelController,
    modifier: SubspaceModifier = SubspaceModifier,
    shape: SpatialShape = SpatialPanelDefaults.shape,
)
```

Creates a [SpatialActivityPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialActivityPanel/api) that launches and displays an Activity within it.

This [SpatialActivityPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialActivityPanel/api) can render any Activity that the application has permission to invoke
as an embedded activity.

The panel size is determined solely by the layout constraints and the provided `modifier` it does
not resize based on the activity content.

#### Parameters

| | |
| --- | --- |
| controller | The [SpatialActivityPanelController](/jetpack-compose/androidx.xr.compose/compose/classes/SpatialActivityPanelController) used to manage the Activities displayed within this panel. It provides a mechanism to queue and dispatch `android.content.Intent`s to the embedded Activity environment. |
| modifier | SubspaceModifiers to apply to the SpatialPanel. The layout size of the panel will dictate the viewport size allocated to the embedded Activity. |
| shape | The shape of this Spatial Panel. |

### SpatialActivityPanel

> Source set: Android

```kotlin
@Composable
@Deprecated(
    message =
        "The `Intent` parameter has been replaced with a `SpatialActivityPanelController` to make" +
            " launching additional activities more explicit. Additionally, `dragPolicy` and " +
            "`resizePolicy` are now specified by modifiers. Use the overload of " +
            "`SpatialActivityPanel` that accepts a `SpatialActivityPanelController`, and migrate " +
            "your drag and resize policy to use the `SubspaceModifier.movable()` and " +
            "`SubspaceModifier.resizable()` modifiers."
)
public fun SpatialActivityPanel(
    intent: Intent,
    modifier: SubspaceModifier = SubspaceModifier,
    shape: SpatialShape = SpatialPanelDefaults.shape,
    interactionPolicy: InteractionPolicy? = null,
)
```

Creates a [SpatialActivityPanel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialActivityPanel/api) and launches an Activity within it.

The only supported use case for this SpatialPanel is to launch activities that are a part of the
same application.

#### Parameters

| | |
| --- | --- |
| intent | The intent of an Activity to launch within this panel. |
| modifier | SubspaceModifiers to apply to the SpatialPanel. The depth field in size-based modifiers affects this panel's layout size, but will not affect how the panel is rendered. The rendered shape will be a flat rectangle that is positioned on the front face of the rectangular prism created by the layout size. |
| shape | The shape of this Spatial Panel. |
| interactionPolicy | An optional [InteractionPolicy](/jetpack-compose/androidx.xr.compose/compose/interfaces/InteractionPolicy) that can be set to detect 3D input events. Setting this will not intercept 2D input events and is intended to provide additional spatial input information. |

## Code Examples

### SpatialActivityPanelSample

```kotlin
@Sampled
@Composable
public fun SpatialActivityPanelSample(intent: Intent) {
    // Because the controller is remembered, passing a different intent parameter
    // on recomposition will not update the controller or launch a new activity.
    val controller = rememberSpatialActivityPanelController(intent)

    Subspace { SpatialActivityPanel(controller = controller) }
}
```

### SpatialActivityPanelLaunchedEffectSample

```kotlin
@Sampled
@Composable
public fun SpatialActivityPanelLaunchedEffectSample(pendingItemId: String?) {
    val context = LocalContext.current
    val controller =
        rememberSpatialActivityPanelController(Intent(context, DashboardActivity::class.java))

    Subspace {
        SpatialActivityPanel(controller = controller)

        LaunchedEffect(pendingItemId) {
            val itemId = pendingItemId ?: return@LaunchedEffect
            val detailIntent =
                Intent(context, DetailActivity::class.java).apply { putExtra("ITEM_ID", itemId) }

            controller.startActivity(detailIntent)
        }
    }
}
```

### SpatialActivityPanelRecreateSample

```kotlin
@Sampled
@Composable
public fun SpatialActivityPanelRecreateSample() {
    val context = LocalContext.current
    var selectedEmailId by remember { mutableStateOf<String?>(null) }

    Column {
        Button(onClick = { selectedEmailId = "email_1" }) { Text("Open Email 1") }

        Button(onClick = { selectedEmailId = "email_2" }) { Text("Open Email 2") }

        if (selectedEmailId != null) {
            Subspace {
                // Using Compose key to force recreation of the controller and
                // the panel whenever the selected email changes. This tears down
                // the old activity stack and starts a new one for the new email.
                key(selectedEmailId) {
                    val intent =
                        Intent(context, NewEmailActivity::class.java).apply {
                            putExtra("EMAIL_ID", selectedEmailId)
                        }
                    SpatialActivityPanel(
                        controller = rememberSpatialActivityPanelController(intent)
                    )
                }
            }
        }
    }
}
```
