Code example for ListView

Methods: getSelectedItemPosition

0
    public void testPreconditions() { 
        assertNotNull(mActivity);
        assertNotNull(mListView);
         
        // First item should be selected 
        assertEquals(0, mListView.getSelectedItemPosition());
    } 
     
    @MediumTest 
    public void testPullDown() { 
        TouchUtils.scrollToTop(this, mListView);
         
        // Nothing should be selected 
        assertEquals("Selection still available after touch", -1, 
                mListView.getSelectedItemPosition());
         
        View firstChild = mListView.getChildAt(0);
         
        assertEquals("Item zero not the first child in the list", 0, firstChild.getId());
         
        assertEquals("Item zero not at the top of the list", mListView.getListPaddingTop(),