ActivityLifecycles

public final class ActivityLifecycles
extends Object

java.lang.Object
   ↳ android.support.test.espresso.util.ActivityLifecycles


Helper methods to understand ActivityLifecycle of the app.

Summary

Public methods

static boolean hasForegroundActivities(ActivityLifecycleMonitor monitor)

Indicates whether or not an Activity in our app is currently in the foreground.

static boolean hasTransitioningActivities(ActivityLifecycleMonitor monitor)

Indicates whether or not an Activity, not in the foreground, exists in our app within the "Visible Lifetime" state.

static boolean hasVisibleActivities(ActivityLifecycleMonitor monitor)

Indicates whether or not an Activity exists in our app within the "Visible Lifetime" state.

Inherited methods

From class java.lang.Object

Public methods

hasForegroundActivities

boolean hasForegroundActivities (ActivityLifecycleMonitor monitor)

Indicates whether or not an Activity in our app is currently in the foreground.

The "Foreground lifetime" of an activity occurs after a call to onResume and before a call to onPause.

During this time, the activity is in front of all other activities and is currently receiving user input.

Parameters
monitor ActivityLifecycleMonitor: the ActivityLifecycleMonitor to use.

Returns
boolean true if an activity exists in the foreground state.

hasTransitioningActivities

boolean hasTransitioningActivities (ActivityLifecycleMonitor monitor)

Indicates whether or not an Activity, not in the foreground, exists in our app within the "Visible Lifetime" state.

The "Visible Lifetime" is defined as an activity where the onStart() method has been called but where the onStop() method has not been called.

During this time, the Activity may be visible to the user, and it may be receiving input from the user. This time is a superset of the "Foreground lifetime" of the activity.

It may be the case that an application has activities in the "visible lifetime" but none in the "Foreground lifetime." It may be the case that without user input an activity will shortly transition into the "Foreground lifetime" in this state, however it also may not transition without further user interaction.

Parameters
monitor ActivityLifecycleMonitor: the ActivityLifecycleMonitor to use

Returns
boolean true if any activity exists with a transitioning stage.

hasVisibleActivities

boolean hasVisibleActivities (ActivityLifecycleMonitor monitor)

Indicates whether or not an Activity exists in our app within the "Visible Lifetime" state.

The "Visible Lifetime" is defined as an activity where the onStart() method has been called but where the onStop() method has not been called.

During this time, the Activity may be visible to the user, and it may be receiving input from the user. This time is a superset of the "Foreground lifetime" of the activity.

It may be the case that an application has activities in the "visible lifetime" but none in the "Foreground lifetime." It may be the case that without user input an activity will shortly transition into the "Foreground lifetime" in this state, however it also may not transition without further user interaction.

Parameters
monitor ActivityLifecycleMonitor: the ActivityLifecycleMonitor to use

Returns
boolean true if any activity exists within it's foreground lifetime.