ActivityCompat

public class ActivityCompat
extends ContextCompat

java.lang.Object
   ↳ androidx.core.content.ContextCompat
     ↳ androidx.core.app.ActivityCompat


Helper for accessing features in Activity.

Summary

Nested classes

interface ActivityCompat.OnRequestPermissionsResultCallback

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

interface ActivityCompat.PermissionCompatDelegate

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

Protected constructors

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

static void finishAffinity(Activity activity)

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

static void finishAfterTransition(Activity activity)

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

static Uri getReferrer(Activity activity)

Return information about who launched this activity.

static boolean invalidateOptionsMenu(Activity activity)

This method is deprecated. Use Activity.invalidateOptionsMenu() directly.

static boolean isLaunchedFromBubble(Activity activity)

Indicates whether this activity is launched from a bubble.

static void postponeEnterTransition(Activity activity)
static void recreate(Activity activity)

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

static DragAndDropPermissionsCompat requestDragAndDropPermissions(Activity activity, DragEvent dragEvent)

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

static void requestPermissions(Activity activity, String[] permissions, int requestCode)

Requests permissions to be granted to this application.

static <T extends View> T requireViewById(Activity activity, int id)

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

static void setEnterSharedElementCallback(Activity activity, SharedElementCallback callback)

When 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.

static void setExitSharedElementCallback(Activity activity, SharedElementCallback callback)

When 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.

static void setLocusContext(Activity activity, LocusIdCompat locusId, Bundle bundle)

Sets the LocusIdCompat for this activity.

static void setPermissionCompatDelegate(ActivityCompat.PermissionCompatDelegate delegate)

Sets the permission delegate for ActivityCompat.

static boolean shouldShowRequestPermissionRationale(Activity activity, String permission)

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

static void startActivityForResult(Activity activity, Intent intent, int requestCode, Bundle options)

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

static void startIntentSenderForResult(Activity activity, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options)

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

static void startPostponedEnterTransition(Activity activity)

Inherited methods