|
我用robitium测试android 4.0的程序,在测试登录页面的语句执行时,出现android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
估计是4.0,只有主线程才能操作控件,那么我的代码如何处理呢?下面是我出错的代码
public void testCanOpenSettings()
{
EditText username=(EditText) solo.getView(R.id.username_input);
username.setText("zzy");
EditText password;
password=(EditText) solo.getView(R.id.password_input);
password.setText("1");
solo.clickOnButton("登录");
boolean expected=true;
boolean actual=solo.searchText("联系人管理");
assertEquals("登录成功",expected,actual );
}
|
|