# ActivityResultLauncher

Artifact: [androidx.activity:activity](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/result/ActivityResultLauncher.kt+class:androidx.activity.result.ActivityResultLauncher) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/activity#1.2.0)

*** ** * ** ***


```
abstract class ActivityResultLauncher<I : Any?>
```

<br />

Known direct subclasses [ManagedActivityResultLauncher](https://developer.android.com/reference/kotlin/androidx/activity/compose/ManagedActivityResultLauncher)

|---|---|
| `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`. |

*** ** * ** ***

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` that takes an `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher` as its required input.

## Summary

| ### Public constructors |
|---|
| `<I : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#ActivityResultLauncher()()` |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)(input: I)` Executes an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)`. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)(input: I, options: https://developer.android.com/reference/kotlin/androidx/core/app/ActivityOptionsCompat?)` Executes an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` and optional `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` for how the Activity should be started. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#unregister()()` Unregisters this launcher, releasing the underlying result callback, and any references captured within it. |

| ### Public properties |
|---|---|
| `abstract https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract<I, *>` | `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#contract()` Returns the `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` that was used to create this launcher. |

| ### Extension functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher<https://developer.android.com/reference/java/lang/Void.html?>.https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#(androidx.activity.result.ActivityResultLauncher).launch(androidx.core.app.ActivityOptionsCompat)(options: https://developer.android.com/reference/kotlin/androidx/core/app/ActivityOptionsCompat?)` Convenience method to launch a no-argument registered call without needing to pass in `null`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html>.https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#(androidx.activity.result.ActivityResultLauncher).launch(androidx.core.app.ActivityOptionsCompat)(options: https://developer.android.com/reference/kotlin/androidx/core/app/ActivityOptionsCompat?)` Convenience method to launch a no-argument registered call without needing to pass in `Unit`. |

## Public constructors

### ActivityResultLauncher

```
<I : Any?> ActivityResultLauncher()
```

## Public functions

### launch

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

```
open fun launch(input: I): Unit
```

Executes an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)`.

This method throws `https://developer.android.com/reference/android/content/ActivityNotFoundException.html` if there was no Activity found to run the given Intent.

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/ActivityNotFoundException.html` |   |

### launch

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

```
abstract fun launch(input: I, options: ActivityOptionsCompat?): Unit
```

Executes an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` and optional `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` for how the Activity should be started.

This method throws `https://developer.android.com/reference/android/content/ActivityNotFoundException.html` if there was no Activity found to run the given Intent.

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/ActivityNotFoundException.html` |   |

### unregister

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

```
@MainThread
abstract fun unregister(): Unit
```

Unregisters this launcher, releasing the underlying result callback, and any references captured within it.

You should call this if the registry may live longer than the callback registered for this launcher.

## Public properties

### contract

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

```
abstract val contract: ActivityResultContract<I, *>
```

Returns the `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` that was used to create this launcher.

## Extension functions

### ActivityResultLauncher.launch

Artifact: [androidx.activity:activity](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/result/ActivityResultLauncher.kt+function:launch)

```
fun ActivityResultLauncher<Void?>.launch(
    options: ActivityOptionsCompat? = null
): Unit
```

Convenience method to launch a no-argument registered call without needing to pass in `null`.

### ActivityResultLauncher.launch

Artifact: [androidx.activity:activity](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/result/ActivityResultLauncher.kt+function:launch)

```
fun ActivityResultLauncher<Unit>.launch(
    options: ActivityOptionsCompat? = null
): Unit
```

Convenience method to launch a no-argument registered call without needing to pass in `Unit`.