Code example for ListView

Methods: scrollToBottomgetHeightgetChildAtgetChildCountgetListPaddingBottomgetAdapter, getSelectedItemPosition

    public void testPushUp() { 
        int originalCount = mListView.getChildCount();
        TouchUtils.scrollToBottom(this, mListView);
        // Nothing should be selected 
        assertEquals("Selection still available after touch", -1, 
        View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
        assertEquals("List is not scrolled to the bottom", mListView.getAdapter().getCount() - 1,
        assertEquals("Last item is not touching the bottom edge",  
                mListView.getHeight() - mListView.getListPaddingBottom(), lastChild.getBottom());
        assertTrue(String.format("Too many children created: %d expected no more than %d", 
                mListView.getChildCount(), originalCount + 1), 
                mListView.getChildCount() <= originalCount + 1);
    public void testPress() { 
        int i;
Stop searching for code, let great code find you!  Add Codota to your java IDE