# androidx.activity.compose

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher` | A launcher for a previously-`https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCaller#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract,androidx.activity.result.ActivityResultCallback)` to start the process of executing an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract`. |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/LocalActivityResultRegistryOwner` | Provides a `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultRegistryOwner` that can be used by Composables hosted in a `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity`. |
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/LocalFullyDrawnReporterOwner` | Provides a `https://developer.android.com/reference/kotlin/androidx/activity/FullyDrawnReporterOwner` that can be used by Composables hosted in a `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity`. |
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/LocalOnBackPressedDispatcherOwner` | Provides a `https://developer.android.com/reference/kotlin/androidx/activity/OnBackPressedDispatcher` that can be used by Composables hosted in a `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity`. |

## Composables

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/BackHandler.composable` | An effect for handling presses of the system back button. |
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/PredictiveBackHandler.composable` | An effect for handling predictive system back gestures. |
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/ReportDrawn.composable` | Calls `https://developer.android.com/reference/android/app/Activity.html#reportFullyDrawn()` after this composition is completed. |
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/ReportDrawnAfter.composable` | Adds `https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#ReportDrawnAfter(kotlin.coroutines.SuspendFunction0)` to the methods that must complete prior to `https://developer.android.com/reference/android/app/Activity.html#reportFullyDrawn()` being called. |
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/ReportDrawnWhen.composable` | Adds `https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#ReportDrawnWhen(kotlin.Function0)` to the conditions that must be met prior to `https://developer.android.com/reference/android/app/Activity.html#reportFullyDrawn()` being called. |
| `https://developer.android.com/reference/kotlin/androidx/activity/compose/rememberLauncherForActivityResult.composable` | Register a request to start an activity for result, designated by the given `https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#rememberLauncherForActivityResult(androidx.activity.result.contract.ActivityResultContract,kotlin.Function1)`. |

## Extension functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity.https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#(androidx.activity.ComponentActivity).setContent(androidx.compose.runtime.CompositionContext,kotlin.Function0)( parent: https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionContext?, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Composes the given composable into the given activity. |

## Top-level properties summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/ProvidableCompositionLocal<https://developer.android.com/reference/android/app/Activity.html?>` | `https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#LocalActivity()` Provides the `https://developer.android.com/reference/android/app/Activity.html` belonging to the current `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#LocalContext()`. |

## Extension functions

### ComponentActivity.setContent

Artifact: [androidx.activity:activity-compose](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/compose/ComponentActivity.kt+function:setContent) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/activity#1.3.0)

```
fun ComponentActivity.setContent(
    parent: CompositionContext? = null,
    content: @Composable () -> Unit
): Unit
```

Composes the given composable into the given activity. The `https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#(androidx.activity.ComponentActivity).setContent(androidx.compose.runtime.CompositionContext,kotlin.Function0)` will become the root view of the given activity.

This is roughly equivalent to calling `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity#setContentView(kotlin.Int)` with a `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/ComposeView` i.e.:

```kotlin
setContentView(
  ComposeView(this).apply {
    setContent {
      MyComposableContent()
    }
  }
)
```

| Parameters |
|---|---|
| `parent: https://developer.android.com/reference/kotlin/androidx/compose/runtime/CompositionContext? = null` | The parent composition reference to coordinate scheduling of composition updates |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A `@Composable` function declaring the UI contents |

## Top-level properties

### LocalActivity

Artifact: [androidx.activity:activity-compose](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/compose/LocalActivity.kt+symbol:LocalActivity) Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/activity#1.10.0)

```
val LocalActivity: ProvidableCompositionLocal<Activity?>
```

Provides the `https://developer.android.com/reference/android/app/Activity.html` belonging to the current `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#LocalContext()`.

Note, when possible you should always prefer using the finer grained composition locals where available. This API should be used as a fallback when the required API is only available via `https://developer.android.com/reference/android/app/Activity.html`.

See `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#LocalLifecycleOwner()` `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#LocalView()`