| <html devsite="true"> |
| <head> |
| <title>UiThread</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="UiThread"> |
| <meta itemprop="path" content="androidx.annotation"> |
| <meta itemprop="language" content="JAVA"> |
| </div> |
| <div id="header-block"> |
| <div> |
| <h1>UiThread</h1> |
| </div> |
| <div id="metadata-info-block"> |
| <div id="source-link"><a href="https://cs.android.com/search?q=file:androidx/annotation/UiThread.kt+class:androidx.annotation.UiThread&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/-must-be-documented/index.html">MustBeDocumented</a><br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-retention/index.html">Retention</a>(value = AnnotationRetention.BINARY)<br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-target/index.html">Target</a>(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER])<br>public annotation <a href="/reference/androidx/annotation/UiThread.html">UiThread</a></pre> |
| </p> |
| <hr> |
| <p>Denotes that the annotated method or constructor should only be called on the UI thread. If the annotated element is a class, then all methods in the class should be called on the UI thread.</p> |
| <p>Example:</p> |
| <pre class="prettyprint">@UiThread<br>public abstract void setText(@NonNull String text) { ... }</pre> |
| <p><b>Note:</b> Ordinarily, an app's UI thread is also the main thread. However, under special circumstances, an app's UI thread might not be its main thread; for more information, see <a href="https://developer.android.com/studio/write/annotations#thread-annotations">Thread annotations</a>.</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="/reference/androidx/annotation/MainThread.html">MainThread</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/UiThread.html#UiThread()">UiThread</a>()</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="list"> |
| <h2>Public constructors</h2> |
| <div class="api-item"><a name="UiThread--"></a><a name="uithread"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="UiThread()">UiThread</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public <a href="/reference/androidx/annotation/UiThread.html#UiThread()">UiThread</a>()</pre> |
| </div> |
| </div> |
| </body> |
| </html> |