title: Espresso, scroll to bottom of dynamical loading ListView
body: <p>normaly scrolling down within a Testcase I could use this peace of code:</p>
  
  <pre><code> onView( withId( R.id.button)).perform( scrollTo(), click());
  </code></pre>
  
  <p>However in this test i want to scroll down a Listview, where the childelements are loaded dynamically (I dont know how many there are), when the view is scrolled down. Is there anything like scroll to bottom in espresso like in Robotium?</p>
  
  <p>My workarround:</p>
  
  <pre><code>int [] childCount =  getListElements();
      for(int i = 0;i&lt;childCount[0];i++) {
          onData(anything()).inAdapterView(withId(R.id.ScheduleOrderListViewListView)).atPosition(i).perform(click());
          childCount =  getListElements();
      }
  </code></pre>
  
  <p>with </p>
  
  <pre><code>public int[] getListElements(){
      final int[] counts = new int[1];
      onView(withId(R.id.ScheduleOrderListViewListView)).check(matches(new TypeSafeMatcher&lt;View&gt;() {
          @Override
          public boolean matchesSafely(View view) {
              ListView listView = (ListView) view;
  
              counts[0] = listView.getCount();
  
              return true;
          }
  
          @Override
          public void describeTo(Description description) {
  
          }
      }));
      return counts;
  </code></pre>