# ApplicationProvider

# ApplicationProvider

Artifact:[androidx.test:core](https://developer.android.com/jetpack/androidx/releases/test)  
[View Source](https://cs.android.com/search?q=file:androidx/test/core/app/ApplicationProvider.java+class:androidx.test.core.app.ApplicationProvider)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/core/app/ApplicationProvider "View this page in Java")

<br />

```
class ApplicationProvider
```

<br />

*** ** * ** ***

Provides ability to retrieve the current application[Context](https://developer.android.com/reference/android/content/Context.html)in tests.

This can be useful if you need to access the application assets (eg*getApplicationContext().getAssets()* ), preferences (eg*getApplicationContext().getSharedPreferences()* ), file system (eg*getApplicationContext().getDir()*) or one of the many other context APIs in test.

## Summary

| ### Public functions |
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static T!`     | `<T : `[Context](https://developer.android.com/reference/android/content/Context.html)`?> `[getApplicationContext](https://developer.android.com/reference/kotlin/androidx/test/core/app/ApplicationProvider#getApplicationContext())`()` Returns the application[android.content.Context](https://developer.android.com/reference/android/content/Context.html)for the application under test. |

## Public functions

### getApplicationContext

```
java-static fun <T : Context?> getApplicationContext(): T!
```

Returns the application[android.content.Context](https://developer.android.com/reference/android/content/Context.html)for the application under test.  

|                                                       See also                                                        |
|-----------------------------------------------------------------------------------------------------------------------|---|
| [getApplicationContext](https://developer.android.com/reference/android/content/Context.html#getApplicationContext()) |   |