ActivityResultContracts.StartActivityForResult


class ActivityResultContracts.StartActivityForResult : ActivityResultContract


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

Can be used with androidx.activity.result.ActivityResultCaller.registerForActivityResult to avoid having to manage request codes when calling an activity API for which a type-safe contract is not available.

Summary

Public constructors

Public functions

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

Create an intent that can be used for android.app.Activity.startActivityForResult.

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

Convert result obtained from android.app.Activity.onActivityResult to O.

Inherited functions

From androidx.activity.result.contract.ActivityResultContract
open ActivityResultContract.SynchronousResult<ActivityResult>?
getSynchronousResult(context: Context, input: Intent)

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

Public constructors

StartActivityForResult

Added in 1.2.0
StartActivityForResult()

Public functions

createIntent

Added in 1.2.0
open fun createIntent(context: Context, input: Intent): Intent

Create an intent that can be used for android.app.Activity.startActivityForResult.

parseResult

Added in 1.10.0-beta01
open fun parseResult(resultCode: Int, intent: Intent?): ActivityResult

Convert result obtained from android.app.Activity.onActivityResult to O.