两种方法,你试下哪种 ok?
boolean ToastFind(String str1){
/*
* 登陆后,通过提示来判定登陆是否成功
*/
TextView toastTextView=solo.getText(0);
if(toastTextView!=null){
String toastText=toastTextView.getText().toString();
solo.sleep(1000);
assertEquals(toastText, str1);
Log.d(TAG, toastText);
}
solo.waitForDialogToClose(2000);
Log.d(TAG, str1);
return true;
}
public void searchToast(String str){
/*
* 弹出提示框,点击确定
*/
if(solo.searchText(str)){
Log.d(TAG2, str);
solo.clickOnText("确定");
gotwoback();
}
else{
Log.d(TAG2, "ok");
solo.goBack();
solo.sleep(500);
solo.goBack();
}
}