Context.IsUiContext Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns true
if the context is a UI context which can access UI components such as
WindowManager
, android.view.LayoutInflater LayoutInflater
or
android.app.WallpaperManager WallpaperManager
.
public virtual bool IsUiContext { [Android.Runtime.Register("isUiContext", "()Z", "GetIsUiContextHandler", ApiSince=31)] get; }
[<get: Android.Runtime.Register("isUiContext", "()Z", "GetIsUiContextHandler", ApiSince=31)>]
member this.IsUiContext : bool
Property Value
- Attributes
Remarks
Returns true
if the context is a UI context which can access UI components such as WindowManager
, android.view.LayoutInflater LayoutInflater
or android.app.WallpaperManager WallpaperManager
. Accessing UI components from non-UI contexts throws android.os.strictmode.Violation
if android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse()
is enabled.
Examples of UI contexts are an android.app.Activity Activity
, a context created from #createWindowContext(int, Bundle)
or android.inputmethodservice.InputMethodService InputMethodService
Note that even if it is allowed programmatically, it is not suggested to override this method to bypass android.os.strictmode.IncorrectContextUseViolation
verification.
Java documentation for android.content.Context.isUiContext()
.
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.