# ActivityLifecycleCallback

# ActivityLifecycleCallback

Artifact:[androidx.test:monitor](https://developer.android.com/jetpack/androidx/releases/test)  
[View Source](https://cs.android.com/search?q=file:androidx/test/runner/lifecycle/ActivityLifecycleCallback.java+class:androidx.test.runner.lifecycle.ActivityLifecycleCallback)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/runner/lifecycle/ActivityLifecycleCallback "View this page in Java")

<br />

```
interface ActivityLifecycleCallback
```

<br />

*** ** * ** ***

Callback for monitoring activity lifecycle events. These callbacks are invoked on the main thread, so any long operations or violating the strict mode policies should be avoided.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onActivityLifecycleChanged](https://developer.android.com/reference/kotlin/androidx/test/runner/lifecycle/ActivityLifecycleCallback#onActivityLifecycleChanged(android.app.Activity,androidx.test.runner.lifecycle.Stage))`(activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html)`!, stage: `[Stage](https://developer.android.com/reference/kotlin/androidx/test/runner/lifecycle/Stage)`!)` Called on the main thread after an activity has processed its lifecycle change event (for example onResume or onStart) |

## Public functions

### onActivityLifecycleChanged

```
fun onActivityLifecycleChanged(activity: Activity!, stage: Stage!): Unit
```

Called on the main thread after an activity has processed its lifecycle change event (for example onResume or onStart)  

|                                                Parameters                                                |
|----------------------------------------------------------------------------------------------------------|--------------------|
| `activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html)`!`             | The activity       |
| `stage: `[Stage](https://developer.android.com/reference/kotlin/androidx/test/runner/lifecycle/Stage)`!` | its current stage. |