# OnContextAvailableListener

Artifact: [androidx.activity:activity](https://developer.android.com/jetpack/androidx/releases/activity) [View Source](https://cs.android.com/search?q=file:androidx/activity/contextaware/OnContextAvailableListener.kt+class:androidx.activity.contextaware.OnContextAvailableListener) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/activity#1.2.0)

*** ** * ** ***


```
fun interface OnContextAvailableListener
```

<br />

*** ** * ** ***

Listener for receiving a callback at the first moment a `https://developer.android.com/reference/android/content/Context.html` is made available to the `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware` class.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)` |   |

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener#onContextAvailable(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Called when the `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware` object this listener was added to is associated to a `https://developer.android.com/reference/android/content/Context.html`. |

## Public functions

### onContextAvailable

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/activity#1.2.0)

```
fun onContextAvailable(context: Context): Unit
```

Called when the `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware` object this listener was added to is associated to a `https://developer.android.com/reference/android/content/Context.html`.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The `https://developer.android.com/reference/android/content/Context.html` the `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware` object is now associated with. |