SaravanaRaja
SaravanaRaja

Reputation: 3406

.getCurrentListViews() method is not available in Robotium for Iterating through list textview.

I want to access the list view child textview value in Robotium test class, through this documentation http://controlingquality.blogspot.in/2011/08/playing-with-android-application.html i see these lines to access textview ListView lvResults = solo.getCurrentListViews().get(0); or ArrayList vTextViewResults = solo.getCurrentTextViews(lvResults); First line is getting the first list used on screen, and second line it getting all TextView controls in ArrayList, but .getCurrentListViews() method is missing. Version i'm using robotium:robotium-solo:5.5.2

Some link also reffered Iterating through a List and clicking on list items in Robotium https://groups.google.com/forum/#!topic/robotium-developers/UY69TKCF5Fw

Upvotes: 0

Views: 127

Answers (1)

SaravanaRaja
SaravanaRaja

Reputation: 3406

After some surfing in net came to know, that from 4.0 (not sure from which version exactly) some methods are replace by generic method.

Prevoius code to get the first list used on screen

ListView list = solo.getCurrentListViews().get(0);

Now to get the same in updates lib it should be

ListView list = solo.getCurrentViews(ListView.class).get(0);

So for Iterating in list TextView it should be

//TODO: Getting all TextView in the List
 for (TextView txt : solo.getCurrentViews(TextView.class, solo.getCurrentViews(ListView.class).get(0))) {
        Log.i("ListItem", txt.getText().toString());

    }

Helpful Link

Upvotes: 1

Related Questions