# MonitoringInstrumentation

Summary:[Nested Classes](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#nestedclasses)\|[Inherited Constants](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#inhconstants)\|[Ctors](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#pubctors)\|[Methods](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#)  

# MonitoringInstrumentation

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


class
MonitoringInstrumentation
`  
`


``


``

extends ExposedInstrumentationApi


``


`

|---|---|---|-------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [android.app.Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html) |||
|   | ↳ | android.support.test.internal.runner.hidden.ExposedInstrumentationApi ||
|   |   | ↳ | android.support.test.runner.MonitoringInstrumentation |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#)Known Direct Subclasses [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner) |--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner) | An[Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)that runs JUnit3 and JUnit4 tests against an Android package (application). | |

<br />

*** ** * ** ***

An instrumentation that enables several advanced features and makes some hard guarantees about the state of the application under instrumentation.

A short list of these capabilities:

- Forces Application.onCreate() to happen before Instrumentation.onStart() runs (ensuring your code always runs in a sane state).
- Logs application death due to exceptions.
- Allows tracking of activity lifecycle states.
- Registers instrumentation arguments in an easy to access place.
- Ensures your activities are creating themselves in reasonable amounts of time.
- Provides facilities to dump current app threads to test outputs.
- Ensures all activities finish before instrumentation exits.

This Instrumentation is \*NOT\* a test instrumentation (some of its subclasses are). It makes no assumptions about what the subclass wants to do.

<br />

## Summary

|                                                                                                                           ### Nested classes                                                                                                                            ||
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [MonitoringInstrumentation.ActivityFinisher](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation.ActivityFinisher) Loops through all the activities that have not yet finished and explicitly calls finish on them. |

|                                                                                                                                                                                                                                                                          ### Inherited constants                                                                                                                                                                                                                                                                           |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#)From class` android.app.Instrumentation ` |-------------------------------------------------------------------------|----------------------------------| | [String](https://developer.android.com/reference/java/lang/String.html) | `REPORT_KEY_IDENTIFIER` <br />   | | [String](https://developer.android.com/reference/java/lang/String.html) | `REPORT_KEY_STREAMRESULT` <br /> | |

|                                                                      ### Public constructors                                                                      ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[MonitoringInstrumentation](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#MonitoringInstrumentation())`() ` |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                                                      | ` `[callActivityOnCreate](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnCreate(android.app.Activity, android.os.Bundle))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` bundle) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` void`                                                                                                                      | ` `[callActivityOnDestroy](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnDestroy(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                      | ` `[callActivityOnPause](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnPause(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                                      | ` `[callActivityOnRestart](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnRestart(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                      | ` `[callActivityOnResume](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnResume(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` void`                                                                                                                      | ` `[callActivityOnStart](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnStart(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                                                      | ` `[callActivityOnStop](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callActivityOnStop(android.app.Activity))`(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                                      | ` `[callApplicationOnCreate](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#callApplicationOnCreate(android.app.Application))`(`[Application](https://developer.android.com/reference/android/app/Application.html)` app) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                                      | ` `[execStartActivities](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivities(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent[], android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent[]](https://developer.android.com/reference/android/content/Intent.html)` intents, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Fragment, android.content.Intent, int, android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent, int, android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent, int, android.os.Bundle, android.os.UserHandle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options, `[UserHandle](https://developer.android.com/reference/android/os/UserHandle.html)` user) ` This API was added in Android API 17 (JELLY_BEAN_MR1)                                                                                                                                                                                                                                                                                             |
| ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, android.app.Activity, android.content.Intent, int))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode) ` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[execStartActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#execStartActivity(android.content.Context, android.os.IBinder, android.os.IBinder, java.lang.String, android.content.Intent, int, android.os.Bundle))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` who, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` contextThread, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[String](https://developer.android.com/reference/java/lang/String.html)` target, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, int requestCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` options) ` This API was added in Android API 23 (M)                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                                      | ` `[finish](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#finish(int, android.os.Bundle))`(int resultCode, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` results) ` Ensures all activities launched in this instrumentation are finished before the instrumentation exits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` void`                                                                                                                      | ` `[interceptActivityUsing](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#interceptActivityUsing(android.support.test.runner.intercepting.InterceptingActivityFactory))`(`[InterceptingActivityFactory](https://developer.android.com/reference/android/support/test/runner/intercepting/InterceptingActivityFactory)` interceptingActivityFactory) ` Use the given InterceptingActivityFactory to create Activity instance in[newActivity(ClassLoader, String, Intent)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                             | ` `[newActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.Class<?>, android.content.Context, android.os.IBinder, android.app.Application, android.content.Intent, android.content.pm.ActivityInfo, java.lang.CharSequence, android.app.Activity, java.lang.String, java.lang.Object))`(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> clazz, `[Context](https://developer.android.com/reference/android/content/Context.html)` context, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` token, `[Application](https://developer.android.com/reference/android/app/Application.html)` application, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, `[ActivityInfo](https://developer.android.com/reference/android/content/pm/ActivityInfo.html)` info, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence.html)` title, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` parent, `[String](https://developer.android.com/reference/java/lang/String.html)` id, `[Object](https://developer.android.com/reference/java/lang/Object.html)` lastNonConfigurationInstance) ` |
| ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                             | ` `[newActivity](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent))`(`[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)` cl, `[String](https://developer.android.com/reference/java/lang/String.html)` className, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` void`                                                                                                                      | ` `[onCreate](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onCreate(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arguments) ` Sets up lifecycle monitoring, and argument registry.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` void`                                                                                                                      | ` `[onDestroy](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onDestroy())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` boolean`                                                                                                                   | ` `[onException](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onException(java.lang.Object, java.lang.Throwable))`(`[Object](https://developer.android.com/reference/java/lang/Object.html)` obj, `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` e) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` void`                                                                                                                      | ` `[onStart](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#onStart())`() ` This implementation of onStart() will guarantee that the Application's onCreate method has completed when it returns.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                             | ` `[startActivitySync](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#startActivitySync(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                                      | ` `[useDefaultInterceptingActivityFactory](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#useDefaultInterceptingActivityFactory())`() ` Use default mechanism of creating activity instance in[newActivity(ClassLoader, String, Intent)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

|                                                                                                                                                                                                                 ### Protected methods                                                                                                                                                                                                                  ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                    | ` `[dumpThreadStateToOutputs](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#dumpThreadStateToOutputs(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` outputFileName) `                                                                                                       |
| ` `[String](https://developer.android.com/reference/java/lang/String.html) | ` `[getThreadState](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#getThreadState())`() `                                                                                                                                                                                                                                   |
| ` void`                                                                    | ` `[installMultidex](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#installMultidex())`() `                                                                                                                                                                                                                                 |
| ` void`                                                                    | ` `[installOldMultiDex](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#installOldMultiDex(java.lang.Class<?>))`(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> multidexClass) ` Perform application MultiDex installation only when instrumentation installation is not available.              |
| ` boolean`                                                                 | ` `[isPrimaryInstrProcess](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#isPrimaryInstrProcess(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` argsProcessName) ` Checks whether this instance of instrumentation should be considered as a primary instrumentation process. |
| ` final void`                                                              | ` `[setJsBridgeClassName](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#setJsBridgeClassName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` className) `                                                                                                                    |
| ` void`                                                                    | ` `[specifyDexMakerCacheProperty](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#specifyDexMakerCacheProperty())`() `                                                                                                                                                                                                       |
| ` void`                                                                    | ` `[waitForActivitiesToComplete](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#waitForActivitiesToComplete())`() ` Ensures we've onStopped() all activities which were onStarted().                                                                                                                                        |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#)From class` android.support.test.internal.runner.hidden.ExposedInstrumentationApi ` |------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                                                      | ` execStartActivities(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent[]](https://developer.android.com/reference/android/content/Intent.html)` arg4, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg5) `                                                                                                | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5) `                                                                                                                                                                           | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6) `                                                                                          | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[String](https://developer.android.com/reference/java/lang/String.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6) `                                                                                                | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6) `                                                                                          | | ` `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` execStartActivity(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6, `[UserHandle](https://developer.android.com/reference/android/os/UserHandle.html)` arg7) ` | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#)From class` `[android.app.Instrumentation](https://developer.android.com/reference/android/app/Instrumentation.html)` ` |--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` TestLooperManager`                                                                                                           | ` acquireLooperManager(`[Looper](https://developer.android.com/reference/android/os/Looper.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html) | ` addMonitor(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0, `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)` arg1, boolean arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html) | ` addMonitor(`[IntentFilter](https://developer.android.com/reference/android/content/IntentFilter.html)` arg0, `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)` arg1, boolean arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` void`                                                                                                                        | ` addMonitor(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                        | ` addResults(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                        | ` callActivityOnDestroy(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnNewIntent(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                        | ` callActivityOnPause(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` callActivityOnPostCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                        | ` callActivityOnPostCreate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` callActivityOnRestart(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` callActivityOnRestoreInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` callActivityOnRestoreInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                                                        | ` callActivityOnResume(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` void`                                                                                                                        | ` callActivityOnSaveInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1, `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                        | ` callActivityOnSaveInstanceState(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                        | ` callActivityOnStart(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` callActivityOnStop(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                        | ` callActivityOnUserLeaving(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` callApplicationOnCreate(`[Application](https://developer.android.com/reference/android/app/Application.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                                                     | ` checkMonitorHit(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0, int arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                        | ` endPerformanceSnapshot() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` void`                                                                                                                        | ` finish(int arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                    | ` getAllocCounts() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                    | ` getBinderCounts() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)                                 | ` getComponentName() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` `[Context](https://developer.android.com/reference/android/content/Context.html)                                             | ` getContext() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` `[String](https://developer.android.com/reference/java/lang/String.html)                                                     | ` getProcessName() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` `[Context](https://developer.android.com/reference/android/content/Context.html)                                             | ` getTargetContext() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` `[UiAutomation](https://developer.android.com/reference/android/app/UiAutomation.html)                                       | ` getUiAutomation(int arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` `[UiAutomation](https://developer.android.com/reference/android/app/UiAutomation.html)                                       | ` getUiAutomation() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                     | ` invokeContextMenuAction(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, int arg1, int arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` boolean`                                                                                                                     | ` invokeMenuActionSync(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, int arg1, int arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` boolean`                                                                                                                     | ` isProfiling() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` newActivity(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> arg0, `[Context](https://developer.android.com/reference/android/content/Context.html)` arg1, `[IBinder](https://developer.android.com/reference/android/os/IBinder.html)` arg2, `[Application](https://developer.android.com/reference/android/app/Application.html)` arg3, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg4, `[ActivityInfo](https://developer.android.com/reference/android/content/pm/ActivityInfo.html)` arg5, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence.html)` arg6, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg7, `[String](https://developer.android.com/reference/java/lang/String.html)` arg8, `[Object](https://developer.android.com/reference/java/lang/Object.html)` arg9) ` | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` newActivity(`[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)` arg0, `[String](https://developer.android.com/reference/java/lang/String.html)` arg1, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` `[Application](https://developer.android.com/reference/android/app/Application.html)                                         | ` newApplication(`[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)` arg0, `[String](https://developer.android.com/reference/java/lang/String.html)` arg1, `[Context](https://developer.android.com/reference/android/content/Context.html)` arg2) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` static `[Application](https://developer.android.com/reference/android/app/Application.html)                                  | ` newApplication(`[Class](https://developer.android.com/reference/java/lang/Class.html)`<?> arg0, `[Context](https://developer.android.com/reference/android/content/Context.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` void`                                                                                                                        | ` onCreate(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` onDestroy() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                                                                     | ` onException(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0, `[Throwable](https://developer.android.com/reference/java/lang/Throwable.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                        | ` onStart() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                        | ` removeMonitor(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                        | ` runOnMainSync(`[Runnable](https://developer.android.com/reference/java/lang/Runnable.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                                                        | ` sendCharacterSync(int arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` sendKeyDownUpSync(int arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                                                        | ` sendKeySync(`[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                        | ` sendPointerSync(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` void`                                                                                                                        | ` sendStatus(int arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                        | ` sendStringSync(`[String](https://developer.android.com/reference/java/lang/String.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                                                        | ` sendTrackballEventSync(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                        | ` setAutomaticPerformanceSnapshots() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                        | ` setInTouchMode(boolean arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` void`                                                                                                                        | ` start() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` startActivitySync(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` startActivitySync(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` void`                                                                                                                        | ` startAllocCounting() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                                                        | ` startPerformanceSnapshot() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` void`                                                                                                                        | ` startProfiling() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                                                        | ` stopAllocCounting() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                        | ` stopProfiling() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` waitForIdle(`[Runnable](https://developer.android.com/reference/java/lang/Runnable.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                        | ` waitForIdleSync() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` waitForMonitor(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                               | ` waitForMonitorWithTimeout(`[Instrumentation.ActivityMonitor](https://developer.android.com/reference/android/app/Instrumentation.ActivityMonitor.html)` arg0, long arg1) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public constructors

### MonitoringInstrumentation

```
MonitoringInstrumentation ()
```

<br />

<br />

## Public methods

### callActivityOnCreate

```
void callActivityOnCreate (Activity activity, 
                Bundle bundle)
```

<br />

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |
| `bundle`   | `Bundle` <br />   |

### callActivityOnDestroy

```
void callActivityOnDestroy (Activity activity)
```

<br />

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |

### callActivityOnPause

```
void callActivityOnPause (Activity activity)
```

<br />

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |

### callActivityOnRestart

```
void callActivityOnRestart (Activity activity)
```

<br />

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |

### callActivityOnResume

```
void callActivityOnResume (Activity activity)
```

<br />

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |

### callActivityOnStart

```
void callActivityOnStart (Activity activity)
```

<br />

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |

### callActivityOnStop

```
void callActivityOnStop (Activity activity)
```

<br />

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |

### callApplicationOnCreate

```
void callApplicationOnCreate (Application app)
```

<br />

<br />

|         Parameters          ||
|-------|----------------------|
| `app` | `Application` <br /> |

### execStartActivities

```
void execStartActivities (Context who, 
                IBinder contextThread, 
                IBinder token, 
                Activity target, 
                Intent[] intents, 
                Bundle options)
```

<br />

<br />

|             Parameters             ||
|-----------------|-------------------|
| `who`           | `Context` <br />  |
| `contextThread` | `IBinder` <br />  |
| `token`         | `IBinder` <br />  |
| `target`        | `Activity` <br /> |
| `intents`       | `Intent` <br />   |
| `options`       | `Bundle` <br />   |

### execStartActivity

```
Instrumentation.ActivityResult execStartActivity (Context who, 
                IBinder contextThread, 
                IBinder token, 
                Fragment target, 
                Intent intent, 
                int requestCode, 
                Bundle options)
```

<br />

<br />

|             Parameters             ||
|-----------------|-------------------|
| `who`           | `Context` <br />  |
| `contextThread` | `IBinder` <br />  |
| `token`         | `IBinder` <br />  |
| `target`        | `Fragment` <br /> |
| `intent`        | `Intent` <br />   |
| `requestCode`   | `int` <br />      |
| `options`       | `Bundle` <br />   |

|                                                              Returns                                                              ||
|---------------------------------------------------------------------------------------------------------------------------|--------|
| [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | <br /> |

### execStartActivity

```
Instrumentation.ActivityResult execStartActivity (Context who, 
                IBinder contextThread, 
                IBinder token, 
                Activity target, 
                Intent intent, 
                int requestCode, 
                Bundle options)
```

<br />

<br />

|             Parameters             ||
|-----------------|-------------------|
| `who`           | `Context` <br />  |
| `contextThread` | `IBinder` <br />  |
| `token`         | `IBinder` <br />  |
| `target`        | `Activity` <br /> |
| `intent`        | `Intent` <br />   |
| `requestCode`   | `int` <br />      |
| `options`       | `Bundle` <br />   |

|                                                              Returns                                                              ||
|---------------------------------------------------------------------------------------------------------------------------|--------|
| [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | <br /> |

### execStartActivity

```
Instrumentation.ActivityResult execStartActivity (Context who, 
                IBinder contextThread, 
                IBinder token, 
                Activity target, 
                Intent intent, 
                int requestCode, 
                Bundle options, 
                UserHandle user)
```

This API was added in Android API 17 (JELLY_BEAN_MR1)

<br />

|              Parameters              ||
|-----------------|---------------------|
| `who`           | `Context` <br />    |
| `contextThread` | `IBinder` <br />    |
| `token`         | `IBinder` <br />    |
| `target`        | `Activity` <br />   |
| `intent`        | `Intent` <br />     |
| `requestCode`   | `int` <br />        |
| `options`       | `Bundle` <br />     |
| `user`          | `UserHandle` <br /> |

|                                                              Returns                                                              ||
|---------------------------------------------------------------------------------------------------------------------------|--------|
| [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | <br /> |

### execStartActivity

```
Instrumentation.ActivityResult execStartActivity (Context who, 
                IBinder contextThread, 
                IBinder token, 
                Activity target, 
                Intent intent, 
                int requestCode)
```

<br />

<br />

|             Parameters             ||
|-----------------|-------------------|
| `who`           | `Context` <br />  |
| `contextThread` | `IBinder` <br />  |
| `token`         | `IBinder` <br />  |
| `target`        | `Activity` <br /> |
| `intent`        | `Intent` <br />   |
| `requestCode`   | `int` <br />      |

|                                                              Returns                                                              ||
|---------------------------------------------------------------------------------------------------------------------------|--------|
| [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | <br /> |

### execStartActivity

```
Instrumentation.ActivityResult execStartActivity (Context who, 
                IBinder contextThread, 
                IBinder token, 
                String target, 
                Intent intent, 
                int requestCode, 
                Bundle options)
```

This API was added in Android API 23 (M)

<br />

|            Parameters             ||
|-----------------|------------------|
| `who`           | `Context` <br /> |
| `contextThread` | `IBinder` <br /> |
| `token`         | `IBinder` <br /> |
| `target`        | `String` <br />  |
| `intent`        | `Intent` <br />  |
| `requestCode`   | `int` <br />     |
| `options`       | `Bundle` <br />  |

|                                                              Returns                                                              ||
|---------------------------------------------------------------------------------------------------------------------------|--------|
| [Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | <br /> |

### finish

```
void finish (int resultCode, 
                Bundle results)
```

Ensures all activities launched in this instrumentation are finished before the instrumentation exits.

Subclasses who override this method should do their finish processing and then call super.finish to invoke this logic. Not waiting for all activities to finish() before exiting can cause device wide instability.

<br />

|          Parameters           ||
|--------------|-----------------|
| `resultCode` | `int` <br />    |
| `results`    | `Bundle` <br /> |

### interceptActivityUsing

```
void interceptActivityUsing (InterceptingActivityFactory interceptingActivityFactory)
```

Use the given InterceptingActivityFactory to create Activity instance in[newActivity(ClassLoader, String, Intent)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent)). This can be used to override default behavior of activity in tests e.g. mocking startService() method in Activity under test, to avoid starting the real service and instead verifying that a particular service was started.

<br />

|                                                                                                                                                                             Parameters                                                                                                                                                                              ||
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `interceptingActivityFactory` | `InterceptingActivityFactory`: InterceptingActivityFactory to be used for creating activity instance in[newActivity(ClassLoader, String, Intent)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent)) <br /> |

### newActivity

```
Activity newActivity (Class<?> clazz, 
                Context context, 
                IBinder token, 
                Application application, 
                Intent intent, 
                ActivityInfo info, 
                CharSequence title, 
                Activity parent, 
                String id, 
                Object lastNonConfigurationInstance)
```

<br />

<br />

|                      Parameters                       ||
|--------------------------------|-----------------------|
| `clazz`                        | `Class` <br />        |
| `context`                      | `Context` <br />      |
| `token`                        | `IBinder` <br />      |
| `application`                  | `Application` <br />  |
| `intent`                       | `Intent` <br />       |
| `info`                         | `ActivityInfo` <br /> |
| `title`                        | `CharSequence` <br /> |
| `parent`                       | `Activity` <br />     |
| `id`                           | `String` <br />       |
| `lastNonConfigurationInstance` | `Object` <br />       |

|                                        Returns                                        ||
|-------------------------------------------------------------------------------|--------|
| [Activity](https://developer.android.com/reference/android/app/Activity.html) | <br /> |

|                                                   Throws                                                   ||
|---------------------------------------------------------------------------------------------------------|---|
| [InstantiationException](https://developer.android.com/reference/java/lang/InstantiationException.html) |   |
| [IllegalAccessException](https://developer.android.com/reference/java/lang/IllegalAccessException.html) |   |

### newActivity

```
Activity newActivity (ClassLoader cl, 
                String className, 
                Intent intent)
```

<br />

<br />

|            Parameters             ||
|-------------|----------------------|
| `cl`        | `ClassLoader` <br /> |
| `className` | `String` <br />      |
| `intent`    | `Intent` <br />      |

|                                        Returns                                        ||
|-------------------------------------------------------------------------------|--------|
| [Activity](https://developer.android.com/reference/android/app/Activity.html) | <br /> |

|                                                   Throws                                                   ||
|---------------------------------------------------------------------------------------------------------|---|
| [InstantiationException](https://developer.android.com/reference/java/lang/InstantiationException.html) |   |
| [IllegalAccessException](https://developer.android.com/reference/java/lang/IllegalAccessException.html) |   |
| [ClassNotFoundException](https://developer.android.com/reference/java/lang/ClassNotFoundException.html) |   |

### onCreate

```
void onCreate (Bundle arguments)
```

Sets up lifecycle monitoring, and argument registry.

Subclasses must call up to onCreate(). This onCreate method does not call start() it is the subclasses responsibility to call start if it desires.

<br />

|          Parameters          ||
|-------------|-----------------|
| `arguments` | `Bundle` <br /> |

### onDestroy

```
void onDestroy ()
```

<br />

<br />

### onException

```
boolean onException (Object obj, 
                Throwable e)
```

<br />

<br />

|        Parameters         ||
|-------|--------------------|
| `obj` | `Object` <br />    |
| `e`   | `Throwable` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### onStart

```
void onStart ()
```

This implementation of onStart() will guarantee that the Application's onCreate method has completed when it returns.

Subclasses should call super.onStart() before executing any code that touches the application and it's state.

<br />

### startActivitySync

```
Activity startActivitySync (Intent intent)
```

<br />

<br />

|        Parameters         ||
|----------|-----------------|
| `intent` | `Intent` <br /> |

|                                        Returns                                        ||
|-------------------------------------------------------------------------------|--------|
| [Activity](https://developer.android.com/reference/android/app/Activity.html) | <br /> |

### useDefaultInterceptingActivityFactory

```
void useDefaultInterceptingActivityFactory ()
```

Use default mechanism of creating activity instance in[newActivity(ClassLoader, String, Intent)](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation#newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent))

<br />

## Protected methods

### dumpThreadStateToOutputs

```
void dumpThreadStateToOutputs (String outputFileName)
```

<br />

<br />

|            Parameters             ||
|------------------|-----------------|
| `outputFileName` | `String` <br /> |

### getThreadState

```
String getThreadState ()
```

<br />

<br />

|                                     Returns                                     ||
|-------------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String.html) | <br /> |

### installMultidex

```
void installMultidex ()
```

<br />

<br />

### installOldMultiDex

```
void installOldMultiDex (Class<?> multidexClass)
```

Perform application MultiDex installation only when instrumentation installation is not available. Called when MultiDex class is available but MultiDex.installInstrumentation is not.

<br />

|           Parameters            ||
|-----------------|----------------|
| `multidexClass` | `Class` <br /> |

|                                                          Throws                                                          ||
|-----------------------------------------------------------------------------------------------------------------------|---|
| [NoSuchMethodException](https://developer.android.com/reference/java/lang/NoSuchMethodException.html)                 |   |
| [InvocationTargetException](https://developer.android.com/reference/java/lang/reflect/InvocationTargetException.html) |   |
| [IllegalAccessException](https://developer.android.com/reference/java/lang/IllegalAccessException.html)               |   |

### isPrimaryInstrProcess

```
boolean isPrimaryInstrProcess (String argsProcessName)
```

Checks whether this instance of instrumentation should be considered as a primary instrumentation process.

<br />

|                                     Parameters                                      ||
|-------------------|------------------------------------------------------------------|
| `argsProcessName` | `String`: the process name passed in via test runner args <br /> |

|                                       Returns                                       ||
|-----------|--------------------------------------------------------------------------|
| `boolean` | `true`if the given process is the primary instrumentation process <br /> |

### setJsBridgeClassName

```
void setJsBridgeClassName (String className)
```

<br />

<br />

|          Parameters          ||
|-------------|-----------------|
| `className` | `String` <br /> |

### specifyDexMakerCacheProperty

```
void specifyDexMakerCacheProperty ()
```

<br />

<br />

### waitForActivitiesToComplete

```
void waitForActivitiesToComplete ()
```

Ensures we've onStopped() all activities which were onStarted().

According to Activity's contract, the process is not killable between onStart and onStop. Breaking this contract (which finish() will if you let it) can cause bad behaviour (including a full restart of system_server).

We give the app 2 seconds to stop all its activities, then we proceed.

This should never be run on the main thread.

<br />

-

  ## Classes

  - [AndroidJUnit4](https://developer.android.com/reference/android/support/test/runner/AndroidJUnit4)
  - [AndroidJUnitRunner](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner)
  - [MonitoringInstrumentation](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation)
  - [MonitoringInstrumentation.ActivityFinisher](https://developer.android.com/reference/android/support/test/runner/MonitoringInstrumentation.ActivityFinisher)
  - [UsageTrackerFacilitator](https://developer.android.com/reference/android/support/test/runner/UsageTrackerFacilitator)