ActivityOptionsCompat

public class ActivityOptionsCompat
extends Object

java.lang.Object
   ↳ androidx.core.app.ActivityOptionsCompat


Helper for accessing features in ActivityOptions in a backwards compatible fashion.

Summary

Constants

String EXTRA_USAGE_TIME_REPORT

A long in the extras delivered by requestUsageTimeReport(PendingIntent) that contains the total time (in ms) the user spent in the app flow.

String EXTRA_USAGE_TIME_REPORT_PACKAGES

A Bundle in the extras delivered by requestUsageTimeReport(PendingIntent) that contains detailed information about the time spent in each package associated with the app; each key is a package name, whose value is a long containing the time (in ms).

Protected constructors

ActivityOptionsCompat()

Public methods

Rect getLaunchBounds()

Returns the bounds that should be used to launch the activity.

static ActivityOptionsCompat makeBasic()

Create a basic ActivityOptions that has no special animation associated with it.

static ActivityOptionsCompat makeClipRevealAnimation(View source, int startX, int startY, int width, int height)

Create an ActivityOptions specifying an animation where the new activity is revealed from a small originating area of the screen to its final full representation.

static ActivityOptionsCompat makeCustomAnimation(Context context, int enterResId, int exitResId)

Create an ActivityOptions specifying a custom animation to run when the activity is displayed.

static ActivityOptionsCompat makeScaleUpAnimation(View source, int startX, int startY, int startWidth, int startHeight)

Create an ActivityOptions specifying an animation where the new activity is scaled from a small originating area of the screen to its final full representation.

static ActivityOptionsCompat makeSceneTransitionAnimation(Activity activity, View sharedElement, String sharedElementName)

Create an ActivityOptions to transition between Activities using cross-Activity scene animations.

static ActivityOptionsCompat makeSceneTransitionAnimation(Activity activity, Pair...<View, String> sharedElements)

Create an ActivityOptions to transition between Activities using cross-Activity scene animations.

static ActivityOptionsCompat makeTaskLaunchBehind()

If set along with Intent.FLAG_ACTIVITY_NEW_DOCUMENT then the task being launched will not be presented to the user but will instead be only available through the recents task list.

static ActivityOptionsCompat makeThumbnailScaleUpAnimation(View source, Bitmap thumbnail, int startX, int startY)

Create an ActivityOptions specifying an animation where a thumbnail is scaled from a given position to the new activity window that is being started.

void requestUsageTimeReport(PendingIntent receiver)

Ask the the system track that time the user spends in the app being launched, and report it back once done.

ActivityOptionsCompat setLaunchBounds(Rect screenSpacePixelRect)

Sets the bounds (window size) that the activity should be launched in.

Bundle toBundle()

Returns the created options as a Bundle, which can be passed to ContextCompat.startActivity(Context, android.content.Intent, Bundle).

void update(ActivityOptionsCompat otherOptions)

Update the current values in this ActivityOptions from those supplied in otherOptions.

Inherited methods

Constants

EXTRA_USAGE_TIME_REPORT

public static final String EXTRA_USAGE_TIME_REPORT

A long in the extras delivered by requestUsageTimeReport(PendingIntent) that contains the total time (in ms) the user spent in the app flow.

Constant Value: "android.activity.usage_time"

EXTRA_USAGE_TIME_REPORT_PACKAGES

public static final String EXTRA_USAGE_TIME_REPORT_PACKAGES

A Bundle in the extras delivered by requestUsageTimeReport(PendingIntent) that contains detailed information about the time spent in each package associated with the app; each key is a package name, whose value is a long containing the time (in ms).

Constant Value: "android.usage_time_packages"

Protected constructors

ActivityOptionsCompat

protected ActivityOptionsCompat ()

Public methods

getLaunchBounds

public Rect getLaunchBounds ()

Returns the bounds that should be used to launch the activity.

Returns
Rect Bounds used to launch the activity.

makeBasic