android.support.test.runner.lifecycle.ActivityLifecycleMonitor Java Examples
The following examples show how to use
android.support.test.runner.lifecycle.ActivityLifecycleMonitor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapActivityTest.java From mobile-android-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
static Activity getCurrentActivity() { ActivityLifecycleMonitor registry = ActivityLifecycleMonitorRegistry.getInstance(); Collection<Activity> activities = registry.getActivitiesInStage(Stage.RESUMED); if (activities.size() > 0) { return (Activity) activities.toArray()[0]; } return null; }
Example #2
Source File: Test1.java From mobile-android-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
static Activity getCurrentActivity() { ActivityLifecycleMonitor registry = ActivityLifecycleMonitorRegistry.getInstance(); Collection<Activity> activities = registry.getActivitiesInStage(Stage.RESUMED); if (activities.size() > 0) { return (Activity) activities.toArray()[0]; } return null; }
Example #3
Source File: EspCloseAllActivitiesFunction.java From espresso-macchiato with MIT License | 5 votes |
public static Set<Activity> getActivitiesInStages(Stage... stages) { final Set<Activity> activities = Sets.newHashSet(); final ActivityLifecycleMonitor instance = ActivityLifecycleMonitorRegistry.getInstance(); for (Stage stage : stages) { activities.addAll(instance.getActivitiesInStage(stage)); } return activities; }