RobotiumでUIに関するアクションを実行
RobotiumでSoloではサポートされていない操作を行う必要がある時、textView.setText(“hoge”)のようなUIに対する変更のコードをRobotiumのテストで実行すると、以下のエラーとなります。
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
エラーを回避するには、以下のようにrunOnUiThreadを呼び出してUIスレッド上で実行します。
solo.getCurrentActivity.runOnUiThread(new Runnable {
def run() {
textView.setText("hoge")
}
})