Code example for ListView

Methods: getFirstVisiblePosition

0
    @MediumTest 
    public void testPreconditions() { 
        assertNotNull(mActivity);
        assertNotNull(mListView);
         
        assertEquals(0, mListView.getFirstVisiblePosition());
    } 
     
    /** 
     * Scroll the list using arrows, launch new activity, hit back, make sure we're still scrolled. 
     */ 
    @LargeTest 
    public void testKeyScrolling() { 
        Instrumentation inst = getInstrumentation();
         
        int firstVisiblePosition = arrowScroll(inst);
         
        inst.sendCharacterSync(KeyEvent.KEYCODE_BACK);
        inst.waitForIdleSync();
         
        assertTrue("List changed to touch mode", !mListView.isInTouchMode());