StartActivityForResult

class StartActivityForResult : ActivityResultContract<Intent!, ActivityResult!>
kotlin.Any
   ↳ androidx.activity.result.contract.ActivityResultContract<android.content.Intent, androidx.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 to avoid having to manage request codes when calling an activity API for which a type-safe contract is not available.

Summary

Constants
static String

Key for the extra containing a android.os.Bundle generated from androidx.core.app.ActivityOptionsCompat#toBundle() or android.app.ActivityOptions#toBundle().

Public constructors

An ActivityResultContract that doesn't do any type conversion, taking raw Intent as an input and ActivityResult as an output.

Public methods
Intent
createIntent(@NonNull context: Context, @NonNull input: Intent)

ActivityResult
parseResult(resultCode: Int, @Nullable intent: Intent?)

Inherited functions

Constants

EXTRA_ACTIVITY_OPTIONS_BUNDLE

static val EXTRA_ACTIVITY_OPTIONS_BUNDLE: String

Key for the extra containing a android.os.Bundle generated from androidx.core.app.ActivityOptionsCompat#toBundle() or android.app.ActivityOptions#toBundle(). This will override any ActivityOptionsCompat passed to androidx.activity.result.ActivityResultLauncher#launch(Object, ActivityOptionsCompat)

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

Public constructors

<init>

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 to avoid having to manage request codes when calling an activity API for which a type-safe contract is not available.

Public methods

createIntent

@NonNull fun createIntent(
    @NonNull context: Context,
    @NonNull input: Intent
): Intent

parseResult

@NonNull fun parseResult(
    resultCode: Int,
    @Nullable intent: Intent?
): ActivityResult