# 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)

*** ** * ** ***


```
public final class ApplicationProvider
```

<br />

*** ** * ** ***

Provides ability to retrieve the current application `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 methods |
|---|---|
| `static T` | `<T extends https://developer.android.com/reference/android/content/Context.html> https://developer.android.com/reference/androidx/test/core/app/ApplicationProvider#getApplicationContext()()` Returns the application `https://developer.android.com/reference/android/content/Context.html` for the application under test. |

## Public methods

### getApplicationContext

```
public static T <T extends Context> getApplicationContext()
```

Returns the application `https://developer.android.com/reference/android/content/Context.html` for the application under test.

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