Lingua

StrictMode.VmPolicy.Builder.DetectIncorrectContextUse Method

Definition

Detects attempts to invoke a method on a Context that is not suited for such operation. An example of this is trying to obtain an instance of UI service (e.g. WindowManager ) from a non-visual Context . This is not allowed, since a non-visual Context is not adjusted to any visual area, and therefore can report incorrect metrics or resources.

[Android.Runtime.Register("detectIncorrectContextUse", "()Landroid/os/StrictMode$VmPolicy$Builder;", "", ApiSince=31)]
public Android.OS.StrictMode.VmPolicy.Builder DetectIncorrectContextUse();
[<Android.Runtime.Register("detectIncorrectContextUse", "()Landroid/os/StrictMode$VmPolicy$Builder;", "", ApiSince=31)>]
member this.DetectIncorrectContextUse : unit -> Android.OS.StrictMode.VmPolicy.Builder

Returns

The returned value is non-null.

Attributes

Remarks

Detects attempts to invoke a method on a Context that is not suited for such operation. An example of this is trying to obtain an instance of UI service (e.g. WindowManager ) from a non-visual Context . This is not allowed, since a non-visual Context is not adjusted to any visual area, and therefore can report incorrect metrics or resources.

Java documentation for android.os.StrictMode.VmPolicy.Builder.detectIncorrectContextUse().

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