Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# UiThreadTest\n\nSummary: [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nUiThreadTest\n============\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\n\n\nabstract\n@interface\nUiThreadTest\n`\n\n\n`\n\n\nimplements\n\n`[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation.html)`\n\n\n`\n\n|----------------------------------------------|\n| android.support.test.annotation.UiThreadTest |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nMethods annotated with this annotation will be executed on the application's UI thread (or main\nthread).\n\nThis annotation will only take effect for [Test](/reference/org/junit/Test), [Before](/reference/org/junit/Before) or\n[After](/reference/org/junit/After) methods. \n**See also:**\n\n- [if you need to switch in\n and out of the UI thread within your method.](/reference/android/support/test/rule/ActivityTestRule#runOnUiThread(java.lang.Runnable))\n\nSummary\n-------\n\n| ### Inherited methods |\n|-----------------------|---|\n| 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)`\u003c? extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation.html)`\u003e` | ` 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() ` | ||\n\n-\n\n Annotations\n -----------\n\n - [Beta](/reference/android/support/test/annotation/Beta)\n - [UiThreadTest](/reference/android/support/test/annotation/UiThreadTest)"]]