blob: bacbe32cf7ffba3ebe91cac178abfb760c313f5a [file]
<html devsite="true">
<head>
<title>DisplayContext</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="DisplayContext">
<meta itemprop="path" content="androidx.annotation">
<meta itemprop="language" content="JAVA">
</div>
<div id="header-block">
<div>
<h1>DisplayContext</h1>
</div>
<div id="metadata-info-block">
<div id="source-link"><a href="https://cs.android.com/search?q=file:androidx/annotation/DisplayContext.kt+class:androidx.annotation.DisplayContext&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/DisplayContext.html">DisplayContext</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 is tied to a <code><a href="https://developer.android.com/reference/android/view/Display.html">android.view.Display</a></code> and can be used to obtain one via <code><a href="https://developer.android.com/reference/android/content/Context.html#getDisplay()">android.content.Context.getDisplay</a></code>. Note: it is not considered to be a UI or visual Context and <b>must not</b> be used to obtain UI-related services, 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>. If the UI services mentioned above are required, instead please use Contexts which are marked as <code><a href="/reference/androidx/annotation/UiContext.html">UiContext</a></code>.</p>
<p><code><a href="https://developer.android.com/reference/android/app/Activity.html">android.app.Activity</a></code>, Context instances created with <code><a href="https://developer.android.com/reference/android/content/Context.html#createWindowContext(kotlin.Int, android.os.Bundle)">android.content.Context.createWindowContext</a></code> or <code><a href="https://developer.android.com/reference/android/content/Context.html#createDisplayContext(android.view.Display)">android.content.Context.createDisplayContext</a></code> can be used to get an associated <code><a href="https://developer.android.com/reference/android/view/Display.html">android.view.Display</a></code> instance.</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#createDisplayContext(android.view.Display)">createDisplayContext</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/UiContext.html">UiContext</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/DisplayContext.html#DisplayContext()">DisplayContext</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="DisplayContext--"></a><a name="displaycontext"></a>
<div class="api-name-block">
<div>
<h3 id="DisplayContext()">DisplayContext</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/annotation/DisplayContext.html#DisplayContext()">DisplayContext</a>()</pre>
</div>
</div>
</body>
</html>