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 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 final @NonNull String

Key for the extra containing a android.os.Bundle generated from toBundle or toBundle.

Public methods

@NonNull @Override Intent

Create an intent that can be used for startActivityForResult

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

Convert result obtained from onActivityResult to O

Inherited methods

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

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

@NonNull
public static final @NonNull String EXTRA_ACTIVITY_OPTIONS_BUNDLE

Key for the extra containing a android.os.Bundle generated from toBundle or toBundle. This will override any ActivityOptionsCompat passed to launch

Public methods

createIntent

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

Create an intent that can be used for startActivityForResult

parseResult

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

Convert result obtained from onActivityResult to O