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

*** ** * ** ***


```
public final class ActivityResultContracts.StartActivityForResult extends ActivityResultContract<@NonNull Intent, @NonNull ActivityResult>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.activity.result.contract.ActivityResultContract](https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [Intent](https://developer.android.com/reference/android/content/Intent.html), @[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [ActivityResult](https://developer.android.com/reference/androidx/activity/result/ActivityResult)\> ||
|   | ↳ | [androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult](https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult) |

*** ** * ** ***

An `https://developer.android.com/reference/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/androidx/activity/result/ActivityResult` as an output.

Can be used with `https://developer.android.com/reference/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 |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/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/androidx/core/app/ActivityOptionsCompat#toBundle()` or `https://developer.android.com/reference/android/app/ActivityOptions.html#toBundle()`. |

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

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html` | `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult#createIntent(android.content.Context,android.content.Intent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html input)` Create an intent that can be used for `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/activity/result/ActivityResult` | `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult#parseResult(kotlin.Int,android.content.Intent)(int resultCode, https://developer.android.com/reference/android/content/Intent.html intent)` 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/androidx/activity/result/contract/ActivityResultContract`. |

### Inherited methods

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

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

```
public static final @NonNull String 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/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/androidx/core/app/ActivityOptionsCompat` passed to `https://developer.android.com/reference/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)

```
public StartActivityForResult()
```

## Public methods

### createIntent

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

```
public @NonNull Intent createIntent(@NonNull Context context, @NonNull Intent input)
```

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

### parseResult

```
public @NonNull ActivityResult parseResult(int resultCode, Intent intent)
```

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/androidx/activity/result/contract/ActivityResultContract`.