@After
    public void unregisterIdlingResource() {
        if (mIdlingResource != null) {
            IdlingRegistry.getInstance().unregister(mIdlingResource);
        }
    }
Use {@link ActivityScenario to launch and get access to the activity.
{@link ActivityScenario#onActivity(ActivityScenario.ActivityAction)} provides a thread-safe
mechanism to access the activity.
ui/espresso/IdlingResourceSample/app/src/androidTest/java/com/example/android/testing/espresso/IdlingResourceSample/ChangeTextBehaviorTest.java