# 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)

*** ** * ** ***


```
public abstract class ActivityResultLauncher<I extends Object>
```

<br />

*** ** * ** ***

A launcher for a previously-`https://developer.android.com/reference/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/androidx/activity/result/contract/ActivityResultContract` that takes an `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher` as its required input.

## Summary

| ### Public constructors |
|---|
| `<I extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#ActivityResultLauncher()()` |

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract<@https://developer.android.com/reference/androidx/annotation/NonNull I, @https://developer.android.com/reference/androidx/annotation/NonNull ?>` | `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#getContract()()` Returns the `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` that was used to create this launcher. |
| `void` | `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull I input)` Executes an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)`. |
| `abstract void` | `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)(@https://developer.android.com/reference/androidx/annotation/NonNull I input, https://developer.android.com/reference/androidx/core/app/ActivityOptionsCompat options)` Executes an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` and optional `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` for how the Activity should be started. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#unregister()()` Unregisters this launcher, releasing the underlying result callback, and any references captured within it. |

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

## Public constructors

### ActivityResultLauncher

```
public <I extends Object> ActivityResultLauncher()
```

## Public methods

### getContract

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

```
public abstract @NonNull ActivityResultContract<@NonNull I, @NonNull ?> getContract()
```

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

### launch

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

```
public void launch(@NonNull I input)
```

Executes an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/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)

```
public abstract void launch(@NonNull I input, ActivityOptionsCompat options)
```

Executes an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` given the required `https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any,androidx.core.app.ActivityOptionsCompat)` and optional `https://developer.android.com/reference/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
public abstract void unregister()
```

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.

## Extension functions

### ActivityResultLauncherKt.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)

```
public final void ActivityResultLauncherKt.launch(
    @NonNull ActivityResultLauncher<Void> receiver,
    ActivityOptionsCompat options
)
```

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

### ActivityResultLauncherKt.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)

```
public final void ActivityResultLauncherKt.launch(
    @NonNull ActivityResultLauncher<Unit> receiver,
    ActivityOptionsCompat options
)
```

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