Reputation: 76
I am testing my android application using robotium, but now I am facing a problem. Much of the part of UI of application is manipulated using response of server i.e application talks with web servies and receives data. I have created TextViews dynamically using that data. Now I can find any view on activity that is already in the layout file but problem is I couldn't figure out how to find the views that are created dynamically using Robotium?
Upvotes: 2
Views: 341
Reputation: 5819
You have a few options to solve this depending on how much access you have to the code.
If you have lots of access to the code set an ID on each view that you create and that way you can use the normal robotium method of getting by id, to set the id do the following:
view.setID(123);
If you can control the text the server sends you can use robotium method to click on text:
solo.clickOnText("xxx");
Or you can use some of robotium's methods e.g. getCurrentViews or getView to filter for just the text views on the screen and if you know what was displayed before the request then anything that appeared in the second call to it is the new views.
Upvotes: 1