1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119<!DOCTYPE html> 120<html devsite> 121<head> 122 123 124 <meta name="top_category" value="develop" /> 125 126 <meta name="subcategory" value="reference" /> 127 128 129 <meta name="book_path" value="/reference/android/support/test/_book.yaml" /> 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145<title>UiThreadTest</title> 146 147 148</head> 149 150<body class="gc-documentation develop reference api apilevel-"> 151<div id="doc-api-level" class="" style="display:none"></div> 152 153 154 155 156<div id="naMessage"></div> 157 158<div id="api-info-block"> 159<div class="api-level"> 160 161 162 163 164</div> 165 166 167 168 169 170 171 172 173 174 175 176<div class="sum-details-links"> 177 178Summary: 179 180 181 182 183 184 185 186 187 188 189 190 191 192 <a href="#inhmethods">Inherited Methods</a> 193 194| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a> 195 196</div><!-- end sum-details-links --> 197</div><!-- end api-info-block --> 198 199<div class="api apilevel-" id="jd-content"> 200 201<!-- ======== START OF CLASS DATA ======== --> 202 203<h1 class="api-title">UiThreadTest</h1> 204<p> 205<code class="api-signature"> 206 public 207 208 209 abstract 210 @interface 211 UiThreadTest 212</code> 213<br> 214 215 216<code class="api-signature"> 217 218 219 implements 220 221 Annotation 222 223 224 225</code> 226 227</p><table class="jd-inheritance-table"> 228 229 230 <tr> 231 232 <td colspan="1" class="jd-inheritance-class-cell">android.support.test.annotation.UiThreadTest 233 </td> 234 </tr> 235 236 237</table> 238 239 240 241 242<br><hr> 243 244 245 <p>This annotation should be used along with <code><a href="/reference/android/support/test/rule/UiThreadTestRule.html">UiThreadTestRule</a></code> 246 or with any rule that inherits from it. When the annotation is present, the test method is 247 executed on the application's UI thread (or main thread). 248 <p/> 249 Note, due to current JUnit limitation, methods annotated with 250 <a href="http://junit.sourceforge.net/javadoc/org/junit/Before.html"><code>Before</code></a> and 251 <a href="http://junit.sourceforge.net/javadoc/org/junit/After.html"><code>After</code></a> will 252 also be executed on the UI Thread. Consider using 253 <code><a href="/reference/android/support/test/rule/UiThreadTestRule.html#runOnUiThread(java.lang.Runnable)">runOnUiThread(Runnable)</a></code> if this is an 254 issue.</p> 255 256 257 258 <div> 259 <p><b>See also:</b></p> 260 <ul class="nolist"><li><code><a href="/reference/android/support/test/rule/UiThreadTestRule.html#runOnUiThread(java.lang.Runnable)">runOnUiThread(Runnable)</a></code></li> 261 </ul> 262 </div> 263 264 265 266 267<h2 class="api-section">Summary</h2> 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300<!-- ========== METHOD SUMMARY =========== --> 301<table id="inhmethods" class="methods inhtable"> 302<tr><th><h3>Inherited methods</h3></th></tr> 303 304 305<tr class="api apilevel-" > 306<td colspan="2"> 307 308 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.annotation.Annotation" class="jd-expando-trigger closed" 309 ><img height="34" id="inherited-methods-java.lang.annotation.Annotation-trigger" 310 src="/assets/images/styles/disclosure_down.png" 311 class="jd-expando-trigger-img" /></a>From 312interface 313<code> 314 315 java.lang.annotation.Annotation 316 317</code> 318<div id="inherited-methods-java.lang.annotation.Annotation"> 319 <div id="inherited-methods-java.lang.annotation.Annotation-list" 320 class="jd-inheritedlinks"> 321 </div> 322 <div id="inherited-methods-java.lang.annotation.Annotation-summary" style="display: none;"> 323 <table class="jd-sumtable-expando responsive"> 324 325 326 327 328 <tr class="api apilevel-" > 329 330 331 <td><code> 332 abstract 333 334 335 336 337 Class<? extends Annotation></code> 338 </td> 339 340 <td width="100%"> 341 <code> 342 annotationType() 343 </code> 344 345 </td> 346 </tr> 347 348 349 350 <tr class="api apilevel-" > 351 352 353 <td><code> 354 abstract 355 356 357 358 359 boolean</code> 360 </td> 361 362 <td width="100%"> 363 <code> 364 equals(Object arg0) 365 </code> 366 367 </td> 368 </tr> 369 370 371 372 <tr class="api apilevel-" > 373 374 375 <td><code> 376 abstract 377 378 379 380 381 int</code> 382 </td> 383 384 <td width="100%"> 385 <code> 386 hashCode() 387 </code> 388 389 </td> 390 </tr> 391 392 393 394 <tr class="api apilevel-" > 395 396 397 <td><code> 398 abstract 399 400 401 402 403 String</code> 404 </td> 405 406 <td width="100%"> 407 <code> 408 toString() 409 </code> 410 411 </td> 412 </tr> 413 414 415 416 </table> 417 </div> 418</div> 419</td></tr> 420 421 422</table> 423 424 425 426<!-- XML Attributes --> 427 428 429<!-- Enum Values --> 430 431 432<!-- Constants --> 433 434 435<!-- Fields --> 436 437 438<!-- Public ctors --> 439 440 441 442<!-- ========= CONSTRUCTOR DETAIL ======== --> 443<!-- Protected ctors --> 444 445 446 447<!-- ========= METHOD DETAIL ======== --> 448<!-- Public methdos --> 449 450 451 452<!-- ========= METHOD DETAIL ======== --> 453 454 455 456<!-- ========= END OF CLASS DATA ========= --> 457 458</div><!-- end jd-content --> 459 460 461 462<div class="data-reference-resources-wrapper"> 463 464 <ul data-reference-resources> 465 466 <li><h2>Annotations</h2> 467 <ul> 468 <li class="api apilevel-"><a href="/reference/android/support/test/annotation/Beta.html">Beta</a></li> 469 <li class="selected api apilevel-"><a href="/reference/android/support/test/annotation/UiThreadTest.html">UiThreadTest</a></li> 470 </ul> 471 </li> 472 473 474 475 476 477 </ul> 478 479</div> 480 481 482 483</body> 484</html> 485