ActivityResultContracts.StartActivityForResult

public static final class ActivityResultContracts.StartActivityForResult
extends ActivityResultContract<IntentActivityResult>

java.lang.Object
   ↳ androidx.activity.result.contract.ActivityResultContract<android.content.Intentandroidx.activity.result.ActivityResult>
     ↳ androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult


An ActivityResultContract that doesn't do any type conversion, taking raw Intent as an input and ActivityResult as an output. Can be used with ActivityResultCaller.registerForActivityResult(ActivityResultContract, ActivityResultCallback) to avoid having to manage request codes when calling an activity API for which a type-safe contract is not available.

Summary

Constants

String EXTRA_ACTIVITY_OPTIONS_BUNDLE

Key for the extra containing a Bundle generated from ActivityOptionsCompat.toBundle() or ActivityOptions.toBundle().

Public constructors

StartActivityForResult()

Public methods

Intent createIntent(Context context, Intent input)

Create an intent that can be used for Activity.startActivityForResult(Intent, int)

ActivityResult parseResult(int resultCode, Intent intent)

Convert result obtained from Activity.onActivityResult(int, int, Intent) to O

Inherited methods

Constants

EXTRA_ACTIVITY_OPTIONS_BUNDLE

public static final String EXTRA_ACTIVITY_OPTIONS_BUNDLE

Key for the extra containing a Bundle generated from ActivityOptionsCompat.toBundle() or ActivityOptions.toBundle(). This will override any ActivityOptionsCompat passed to ActivityResultLauncher.launch(Object, ActivityOptionsCompat)

Constant Value: "androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE"

Public constructors

StartActivityForResult

public StartActivityForResult ()

Public methods

createIntent

public Intent createIntent (Context context, 
                Intent input)

Create an intent that can be used for Activity.startActivityForResult(Intent, int)

Parameters
context Context

input Intent

Returns
Intent

parseResult

public ActivityResult parseResult (int resultCode, 
                Intent intent)

Convert result obtained from Activity.onActivityResult(int, int, Intent) to O

Parameters
resultCode int

intent Intent

Returns
ActivityResult