Partager via


ContentProvider.RequireContext Method

Definition

Retrieves a Non-Nullable Context this provider is running in, this is intended to be called after #onCreate.

[Android.Runtime.Register("requireContext", "()Landroid/content/Context;", "", ApiSince=30)]
public Android.Content.Context RequireContext ();
[<Android.Runtime.Register("requireContext", "()Landroid/content/Context;", "", ApiSince=30)>]
member this.RequireContext : unit -> Android.Content.Context

Returns

Attributes

Remarks

Retrieves a Non-Nullable Context this provider is running in, this is intended to be called after #onCreate. When called before context was created, an IllegalStateException will be thrown.

Note A provider must be declared in the manifest and created automatically by the system, and context is only available after #onCreate is called.

Java documentation for android.content.ContentProvider.requireContext().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to