Google is committed to advancing racial equity for Black communities. See how.

ActivityCompat

open class ActivityCompat : ContextCompat
kotlin.Any
   ↳ androidx.core.content.ContextCompat
   ↳ androidx.core.app.ActivityCompat

Helper for accessing features in android.app.Activity.

Summary

Nested classes
abstract

This interface is the contract for receiving the results for permission requests.

abstract

Customizable delegate that allows delegating permission compatibility methods to a custom implementation.

Protected constructors

This class should not be instantiated, but the constructor must be visible for the class to be extended (as in support-v13).

Public methods
open static Unit
finishAffinity(@NonNull activity: Activity)

Finish this activity, and tries to finish all activities immediately below it in the current task that have the same affinity.

open static Unit
finishAfterTransition(@NonNull activity: Activity)

Reverses the Activity Scene entry Transition and triggers the calling Activity to reverse its exit Transition.

open static Uri?
getReferrer(@NonNull activity: Activity)

Return information about who launched this activity.

open static Boolean

Invalidate the activity's options menu, if able.

open static Unit
postponeEnterTransition(@NonNull activity: Activity)

open static Unit
recreate(@NonNull activity: Activity)

Cause the given Activity to be recreated with a new instance.

open static DragAndDropPermissionsCompat?

Create DragAndDropPermissionsCompat object bound to this activity and controlling the access permissions for content URIs associated with the android.view.DragEvent.

open static Unit
requestPermissions(@NonNull activity: Activity, @NonNull permissions: Array<String!>, @IntRange(0) requestCode: Int)

Requests permissions to be granted to this application.

open static T
requireViewById(@NonNull activity: Activity, @IdRes id: Int)

Finds a view that was identified by the android:id XML attribute that was processed in Activity#onCreate, or throws an IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy.

open static Unit
setEnterSharedElementCallback(@NonNull activity: Activity, @Nullable callback: SharedElementCallback?)

When android.app.ActivityOptions#makeSceneTransitionAnimation(Activity, * android.view.View, String) was used to start an Activity, callback will be called to handle shared elements on the launched Activity.

open static Unit
setExitSharedElementCallback(@NonNull activity: Activity, @Nullable callback: SharedElementCallback?)

When android.app.ActivityOptions#makeSceneTransitionAnimation(Activity, * android.view.View, String) was used to start an Activity, callback will be called to handle shared elements on the launching Activity.

open static Unit
setLocusContext(@NonNull activity: Activity, @Nullable locusId: LocusIdCompat?, @Nullable bundle: Bundle?)

Sets the LocusIdCompat for this activity.

open static Unit

Sets the permission delegate for ActivityCompat.

open static Boolean
shouldShowRequestPermissionRationale(@NonNull activity: Activity, @NonNull permission: String)

Gets whether you should show UI with rationale before requesting a permission.

open static Unit
startActivityForResult(@NonNull activity: Activity, @NonNull intent: Intent, requestCode: Int, @Nullable options: Bundle?)

Start new activity with options, if able, for which you would like a result when it finished.

open static Unit
startIntentSenderForResult(@NonNull activity: Activity, @NonNull intent: IntentSender, requestCode: Int, @Nullable fillInIntent: Intent?, flagsMask: Int, flagsValues: Int, extraFlags: Int, @Nullable options: Bundle?)

Start new IntentSender with options, if able, for which you would like a result when it finished.

open static Unit

Inherited functions

Protected constructors

<init>

protected ActivityCompat()

This class should not be instantiated, but the constructor must be visible for the class to be extended (as in support-v13).

Public methods

finishAffinity

open static fun finishAffinity(@NonNull