# UiThreadTest

Summary:[Inherited Methods](https://developer.android.com/reference/android/support/test/annotation/UiThreadTest#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/annotation/UiThreadTest#)  

# UiThreadTest

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


abstract
@interface
UiThreadTest
`  
`


implements

`[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation.html)`


`

|----------------------------------------------|
| android.support.test.annotation.UiThreadTest |

<br />

*** ** * ** ***

Methods annotated with this annotation will be executed on the application's UI thread (or main thread).

This annotation will only take effect for[Test](https://developer.android.com/reference/org/junit/Test),[Before](https://developer.android.com/reference/org/junit/Before)or[After](https://developer.android.com/reference/org/junit/After)methods.  
**See also:**

- [if you need to switch in
  and out of the UI thread within your method.](https://developer.android.com/reference/android/support/test/rule/ActivityTestRule#runOnUiThread(java.lang.Runnable))

## Summary

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/annotation/UiThreadTest#)From interface` `[java.lang.annotation.Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation.html)` ` |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` abstract `[Class](https://developer.android.com/reference/java/lang/Class.html)`<? extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation.html)`>` | ` annotationType() `                                                                       | | ` abstract boolean`                                                                                                                                                                         | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` abstract int`                                                                                                                                                                             | ` hashCode() `                                                                             | | ` abstract `[String](https://developer.android.com/reference/java/lang/String.html)                                                                                                         | ` toString() `                                                                             | ||

-

  ## Annotations

  - [Beta](https://developer.android.com/reference/android/support/test/annotation/Beta)
  - [UiThreadTest](https://developer.android.com/reference/android/support/test/annotation/UiThreadTest)