I have a bunch of Views added programmatically in a loop:
for (int j = 0; j < size(); j++) {
TextView xxxView = (TextView) LayoutInflater.from(getContext()).inflate(R.layout.xxx, container, false);
xxxView.setId(k++); //this is not enough as UI Automator does not see it, id field is empty in UI Automator
container.addView(xxxView);
}
There is about 180 of those Views so it would be quite difficult to create xml with ids but this may be the only solution here.
Maybe some array of ids?