Class ActivityController<T extends Activity>

  • Type Parameters:
    T - a class of the activity which is under control by this class.

    public class ActivityController<T extends Activity>
    extends ComponentController<ActivityController<T>,​T>
    ActivityController provides low-level APIs to control activity's lifecycle.

    Using ActivityController directly from your tests is strongly discouraged. You have to call all the lifecycle callback methods (create, postCreate, start, ...) in the same manner as the Android framework by yourself otherwise you'll see fidelity issues. Consider using androidx.test.core.app.ActivityScenario instead, which provides higher-level, streamlined APIs to control the lifecycle and it works with instrumentation tests too.