我想访问 Robotium 测试类中的列表视图子textview值,通过此文档http://controlingquality.blogspot.in/2011/08/playing-with-android-application.html我看到这些行来访问textview
ListView lvResults = solo.getCurrentListViews().get(0);
或ArrayList vTextViewResults = solo.getCurrentTextViews(lvResults);
第一行是获取屏幕上使用的第一个列表,第二行是获取ArrayList中的所有TextView控件,但缺少 .getCurrentListViews()方法。版本i使用 robotium:robotium-solo:5.5.2
有些链接也提到了Iterating through a List and clicking on list items in Robotium https://groups.google.com/forum/#!topic/robotium-developers/UY69TKCF5Fw
答案 0 :(得分:1)
在网上冲浪之后才知道,从4.0开始(不确定从哪个版本确切),一些方法被泛型方法取代。
Prevoius 代码获取屏幕上使用的第一个列表
http://127.0.0.1:8000/no/where/
现在要在更新lib中获得相同的内容,它应该是
ListView list = solo.getCurrentListViews().get(0);
因此,对于列表TextView中的迭代,它应该是
ListView list = solo.getCurrentViews(ListView.class).get(0);
有用的Link