ActivityResultContracts.StartActivityForResult

public final class ActivityResultContracts.StartActivityForResult extends 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 methods

@NonNull Intent

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

@NonNull ActivityResult
parseResult(int resultCode, @Nullable Intent intent)

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

Inherited methods

From class ActivityResultContract
@Nullable ActivityResultContract.SynchronousResult<@NonNull ActivityResult>

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

Public constructors

StartActivityForResult

public final StartActivityForResult()

Public methods

createIntent

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

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

parseResult

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

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