1

Difference between runOnUiThread() method and @UiThreadTest annotation

view story
linux-howto

http://stackoverflow.com – As the title, can anyone explain the difference between the runOnUiThread() method and the @UiThreadTest annotation? I've been reading through the Android testing tutorial which uses both. It states: Code in a test application that interacts with a View of the application under test must run in the main application's thread, also known as the UI thread. To do this, you use the Activity.runOnUiThread() method and: The @UiThreadTest annotation tells Android to build this method so that it runs on the UI thread. This allows the method to change the state of the spinner widget in the app (HowTos)