# UiContext

Artifact: [androidx.annotation:annotation](https://developer.android.com/jetpack/androidx/releases/annotation) [View Source](https://cs.android.com/search?q=file:androidx/annotation/UiContext.jvm.kt+class:androidx.annotation.UiContext) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.3.0)

*** ** * ** ***

Common/AllAndroid/JVM
- android

  ```
  @Retention(value = AnnotationRetention.SOURCE)
  @Target(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD])
  annotation UiContext
  ```

*** ** * ** ***

Denotes a `https://developer.android.com/reference/android/content/Context.html` that can be used to create UI, meaning that it can provide a `https://developer.android.com/reference/android/view/Display.html` via `https://developer.android.com/reference/android/content/Context.html#getDisplay()` and can be used to obtain an instance of a UI-related service, such as `https://developer.android.com/reference/android/view/WindowManager.html`, `https://developer.android.com/reference/android/view/LayoutInflater.html` or `https://developer.android.com/reference/android/app/WallpaperManager.html` via `https://developer.android.com/reference/android/content/Context.html#getSystemService(java.lang.Class&lt;T&gt;)`. A `https://developer.android.com/reference/android/content/Context.html` which is marked as `https://developer.android.com/reference/kotlin/androidx/annotation/UiContext` implies that the `https://developer.android.com/reference/android/content/Context.html` is also a `https://developer.android.com/reference/kotlin/androidx/annotation/DisplayContext`.

This kind of `https://developer.android.com/reference/android/content/Context.html` is usually an `https://developer.android.com/reference/android/app/Activity.html` or an instance created via `https://developer.android.com/reference/android/content/Context.html#createWindowContext(android.view.Display, int, android.os.Bundle)`. The `https://developer.android.com/reference/android/content/res/Configuration.html` for these types of Context types is correctly adjusted to the visual bounds of your window so it can be used to get the correct values for {link android.view.WindowMetrics} and other UI related queries.

This is a marker annotation and has no specific attributes.

| See also |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html#getDisplay()` |   |
| `https://developer.android.com/reference/android/content/Context.html#getSystemService(java.lang.Class&lt;T&gt;)` |   |
| `https://developer.android.com/reference/android/content/Context.html#getSystemService(java.lang.Class&lt;T&gt;)` |   |
| `https://developer.android.com/reference/android/content/Context.html#createWindowContext(android.view.Display, int, android.os.Bundle)` |   |
| `https://developer.android.com/reference/kotlin/androidx/annotation/DisplayContext` |   |

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/annotation/UiContext#UiContext()()` | android |

## Public constructors

### UiContext

android

```
UiContext()
```