Stay organized with collections Save and categorize content based on your preferences.

ActivityResult

public final class ActivityResult implements Parcelable


A container for an activity result as obtained from onActivityResult

See also
onActivityResult

Summary

Constants

static final @NonNull Parcelable.Creator<ActivityResult>

Public constructors

ActivityResult(int resultCode, @Nullable Intent data)

Create a new instance

Public methods

int
@Nullable Intent
int
static @NonNull String
resultCodeToString(int resultCode)

A readable representation of standard activity result codes

String
void
writeToParcel(@NonNull Parcel dest, int flags)

Extension functions

final int

Destructuring declaration for ActivityResult to provide the requestCode

final Intent

Destructuring declaration for ActivityResult to provide the intent

Inherited Constants

From class android.os.Parcelable
static final int
static final int

Constants

CREATOR

public static final @NonNull Parcelable.Creator<ActivityResultCREATOR

Public constructors

ActivityResult

public ActivityResult(int resultCode, @Nullable Intent data)

Create a new instance

Parameters
int resultCode

status to indicate the success of the operation

@Nullable Intent data

an intent that carries the result data

Public methods

describeContents

public int describeContents()

getData

public @Nullable Intent getData()
Returns
@Nullable Intent

the intent

getResultCode

public int getResultCode()
Returns
int

the resultCode

resultCodeToString

public static @NonNull String resultCodeToString(int resultCode)

A readable representation of standard activity result codes

Parameters
int resultCode

the result code

Returns
@NonNull String

RESULT_OK, RESULT_CANCELED, or the number otherwise

toString

public String toString()

writeToParcel

public void writeToParcel(@NonNull Parcel dest, int flags)

Extension functions

ActivityResultKt.component1

public final int ActivityResultKt.component1(@NonNull ActivityResult receiver)

Destructuring declaration for ActivityResult to provide the requestCode

Returns
int

the resultCode of the ActivityResult

ActivityResultKt.component2

public final Intent ActivityResultKt.component2(@NonNull ActivityResult receiver)

Destructuring declaration for ActivityResult to provide the intent

Returns
Intent

the intent of the ActivityResult