The second Android 11 Developer Preview is now available, test it out and share your feedback.

ContentProviderCompat

public final class ContentProviderCompat
extends Object

java.lang.Object
   ↳ androidx.core.content.ContentProviderCompat


Helper for accessing features in ContentProvider in a backwards compatible fashion.

Summary

Public methods

static Context requireContext(ContentProvider provider)

Returns NonNull context associated with given ContentProvider.

Inherited methods

Public methods

requireContext

public static Context requireContext (ContentProvider provider)

Returns NonNull context associated with given ContentProvider. A provider must be declared in the manifest and created automatically by the system, and context is only available after ContentProvider.onCreate() is called.

Parameters
provider ContentProvider: The ContentProvider.

Returns
Context The Context object associated with the ContentProvider.