blob: 3fb59de7f1ab30b9daaf3b7ead94519274ff57a6 [file]
<html devsite="true">
<head>
<title>UiContext</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div itemscope="" itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="UiContext">
<meta itemprop="path" content="androidx.annotation">
<meta itemprop="language" content="JAVA">
</div>
<div id="header-block">
<div>
<h1>UiContext</h1>
</div>
<div id="metadata-info-block">
<div id="source-link"><a href="https://cs.android.com/search?q=file:androidx/annotation/UiContext.kt+class:androidx.annotation.UiContext&amp;ss=androidx/platform/frameworks/support" class="external">View Source</a></div>
</div>
</div>
<div id="refdoc-switcher-placeholder"></div>
<p>
<pre>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-retention/index.html">Retention</a>(value&nbsp;=&nbsp;AnnotationRetention.SOURCE)<br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-target/index.html">Target</a>(allowedTargets&nbsp;=&nbsp;[AnnotationTarget.ANNOTATION_CLASS,&nbsp;AnnotationTarget.CLASS,&nbsp;AnnotationTarget.FUNCTION,&nbsp;AnnotationTarget.PROPERTY_GETTER,&nbsp;AnnotationTarget.PROPERTY_SETTER,&nbsp;AnnotationTarget.VALUE_PARAMETER,&nbsp;AnnotationTarget.FIELD])<br>public annotation <a href="/reference/androidx/annotation/UiContext.html">UiContext</a></pre>
</p>
<hr>
<p>Denotes a <code><a href="https://developer.android.com/reference/android/content/Context.html">android.content.Context</a></code> that can be used to create UI, meaning that it can provide a <code><a href="https://developer.android.com/reference/android/view/Display.html">android.view.Display</a></code> via <code><a href="https://developer.android.com/reference/android/content/Context.html#getDisplay()">android.content.Context.getDisplay</a></code> and can be used to obtain an instance of a UI-related service, such as <code><a href="https://developer.android.com/reference/android/view/WindowManager.html">android.view.WindowManager</a></code>, <code><a href="https://developer.android.com/reference/android/view/LayoutInflater.html">android.view.LayoutInflater</a></code> or <code><a href="https://developer.android.com/reference/android/app/WallpaperManager.html">android.app.WallpaperManager</a></code> via <code><a href="https://developer.android.com/reference/android/content/Context.html#getSystemService(kotlin.String)">android.content.Context.getSystemService</a></code>. A <code><a href="https://developer.android.com/reference/android/content/Context.html">android.content.Context</a></code> which is marked as <code><a href="/reference/androidx/annotation/UiContext.html">UiContext</a></code> implies that the <code><a href="https://developer.android.com/reference/android/content/Context.html">android.content.Context</a></code> is also a <code><a href="/reference/androidx/annotation/DisplayContext.html">DisplayContext</a></code>.</p>
<p>This kind of <code><a href="https://developer.android.com/reference/android/content/Context.html">android.content.Context</a></code> is usually an <code><a href="https://developer.android.com/reference/android/app/Activity.html">android.app.Activity</a></code> or an instance created via <code><a href="https://developer.android.com/reference/android/content/Context.html#createWindowContext(kotlin.Int, android.os.Bundle)">android.content.Context.createWindowContext</a></code>. The <code><a href="https://developer.android.com/reference/android/content/res/Configuration.html">android.content.res.Configuration</a></code> 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.</p>
<p>This is a marker annotation and has no specific attributes.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">See also</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://developer.android.com/reference/android/content/Context.html#getDisplay()">getDisplay</a></code></td>
<td></td>
</tr>
<tr>
<td><code><a href="https://developer.android.com/reference/android/content/Context.html#getSystemService(kotlin.String)">getSystemService</a></code></td>
<td></td>
</tr>
<tr>
<td><code><a href="https://developer.android.com/reference/android/content/Context.html#getSystemService(kotlin.String)">getSystemService</a></code></td>
<td></td>
</tr>
<tr>
<td><code><a href="https://developer.android.com/reference/android/content/Context.html#createWindowContext(kotlin.Int, android.os.Bundle)">createWindowContext</a></code></td>
<td></td>
</tr>
<tr>
<td><code><a href="/reference/androidx/annotation/DisplayContext.html">DisplayContext</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code><a href="/reference/androidx/annotation/UiContext.html#UiContext()">UiContext</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="UiContext--"></a><a name="uicontext"></a>
<div class="api-name-block">
<div>
<h3 id="UiContext()">UiContext</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/annotation/UiContext.html#UiContext()">UiContext</a>()</pre>
</div>
</div>
</body>
</html>