public final class

ApplicationProvider

extends Object
java.lang.Object
   ↳ androidx.test.core.app.ApplicationProvider

Class Overview

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.

Summary

Public Methods
static <T extends Context> T getApplicationContext()
Returns the application Context for the application under test.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static T getApplicationContext ()

Returns the application Context for the application under test.

Returns
T