{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
class ApplicationProvider
Provides ability to retrieve the current application Context 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.
Public constructors |
|
|---|---|
Public functions |
|
|---|---|
java-static T! |
<T : Context?> getApplicationContext()Returns the application android.content.Context for the application under test. |
java-static fun <T : Context?> getApplicationContext(): T!
Returns the application android.content.Context for the application under test.
| See also | |
|---|---|
Context |
|