How to select from long list

Hi,

I need to select 200 contact from contact list.I use this function I built to get to the contact name xPath and click on it.

public UiObject Contact(int index){
Contact = new UiSelector().xPath("//android.widget.TabHost[@index=‘2’]/android.widget.LinearLayout[@index=‘0’]/android.widget.FrameLayout[@index=‘2’]/android.widget.FrameLayout[@index=‘0’]/android.widget.ListView[@index=‘0’]/android.widget.RelativeLayout[@index=’"+index+"’]").makeUiObject();
return Contact;
}

My problem is that only the first 10 contact are shown on the screen when i enter to the screen and after I select them the test crashes because it can not reach the next contact in line because it is not displayed on the screen and I do not have the xPath to it

How can I overcome this and choose 200 contact?

I also attach a screenshot of the screen

Thanks !!

you can only scroll and grab next 10 contacts.

Thanks !

The truth I thought about it. I can scroll to a certain string. but in my case i dont have string to scroll to. How do I scroll down (Eg scroll 10 inches down) ?

Thanks !

easier ask dev to set item num for RelativeLayout in ListView (if it is not yet done) thus you can scroll to any element easily.

Can you please show me an example? Thanks !

example of what?
for scrolling to some element with some text or id you can use - What are the alternatives for scrollTo() and scrollToExact(), Please suggest other than (x,y) co-ordinators

This is what i ask for. :slight_smile:
Thanks again !