# ActivityResultContracts.StartActivityForResult

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

*** ** * ** ***


```
class ActivityResultContracts.StartActivityForResult : ActivityResultContract<Intent, ActivityResult>
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.activity.result.contract.ActivityResultContract](https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract)\<[Intent](https://developer.android.com/reference/android/content/Intent.html), [ActivityResult](https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResult)\> ||
|   | ↳ | [androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult](https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult) |

*** ** * ** ***

An `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` that doesn't do any type conversion, taking raw `https://developer.android.com/reference/android/content/Intent.html` as an input and `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResult` as an output.

Can be used with `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCaller#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract,androidx.activity.result.ActivityResultCallback)` to avoid having to manage request codes when calling an activity API for which a type-safe contract is not available.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult#EXTRA_ACTIVITY_OPTIONS_BUNDLE()` Key for the extra containing a `https://developer.android.com/reference/android/os/Bundle.html` generated from `https://developer.android.com/reference/kotlin/androidx/core/app/ActivityOptionsCompat#toBundle()` or `https://developer.android.com/reference/android/app/ActivityOptions.html#toBundle()`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult#StartActivityForResult()()` |

| ### Public functions |
|---|---|
| `open https://developer.android.com/reference/android/content/Intent.html` | `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult#createIntent(android.content.Context,android.content.Intent)(context: https://developer.android.com/reference/android/content/Context.html, input: https://developer.android.com/reference/android/content/Intent.html)` Create an intent that can be used for `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`. |
| `open https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResult` | `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult#parseResult(kotlin.Int,android.content.Intent)(resultCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, intent: https://developer.android.com/reference/android/content/Intent.html?)` Convert result obtained from `https://developer.android.com/reference/android/app/Activity.html#onActivityResult(int, int, android.content.Intent)` to `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract`. |

### Inherited functions

From [androidx.activity.result.contract.ActivityResultContract](https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract) `open https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract.SynchronousResult<https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResult>?` `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract#getSynchronousResult(android.content.Context,kotlin.Any)(context: https://developer.android.com/reference/android/content/Context.html, input: https://developer.android.com/reference/android/content/Intent.html)`

An optional method you can implement that can be used to potentially provide a result in lieu of starting an activity.

## Constants

### EXTRA_ACTIVITY_OPTIONS_BUNDLE

```
const val EXTRA_ACTIVITY_OPTIONS_BUNDLE: String
```

Key for the extra containing a `https://developer.android.com/reference/android/os/Bundle.html` generated from `https://developer.android.com/reference/kotlin/androidx/core/app/ActivityOptionsCompat#toBundle()` or `https://developer.android.com/reference/android/app/ActivityOptions.html#toBundle()`.

This will override any `https://developer.android.com/reference/kotlin/androidx/core/app/ActivityOptionsCompat` passed to `https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher#launch(kotlin.Any)`

## Public constructors

### StartActivityForResult

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

```
StartActivityForResult()
```

## Public functions

### createIntent

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

```
open fun createIntent(context: Context, input: Intent): Intent
```

Create an intent that can be used for `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`.

### parseResult

```
open fun parseResult(resultCode: Int, intent: Intent?): ActivityResult
```

Convert result obtained from `https://developer.android.com/reference/android/app/Activity.html#onActivityResult(int, int, android.content.Intent)` to `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract`.