Code example for AbsListView

Methods: getCount, getFirstVisiblePosition, getLastVisiblePosition, sleep

0
     */ 
    protected void pause() 
    { 
        try 
        { 
            Thread.sleep(250);
        } 
        catch (InterruptedException e)
        { 
            // Do nothing. 
        } 
    } 
 
 
    //~ Inner classes ......................................................... 
 
    // ---------------------------------------------------------- 
    /** 
     * A "null" scroller that does not actually do any scrolling. 
     */ 
    private static class NullScroller extends AndroidScroller 
    { 
        // ---------------------------------------------------------- 
        @Override 
        public boolean scroll(Direction direction)
        { 
            // Do nothing and immediately return that no more scrolling is 
            // possible. 
            return false; 
        } 
    } 
 
 
    // ---------------------------------------------------------- 
    /** 
     * A scroller for ListViews. 
     */ 
    private static class AbsListViewScroller extends AndroidScroller 
    { 
        // ---------------------------------------------------------- 
        @Override 
        public boolean scroll(Direction direction)
        { 
            AbsListView lv = (AbsListView) view;
 
            if (direction == Direction.DOWN)
            { 
                if (lv.getLastVisiblePosition() >= lv.getCount() - 1)
                { 
                    scrollToLine(lv.getLastVisiblePosition());
                    return false; 
                } 
 
                if (lv.getFirstVisiblePosition() != lv.getLastVisiblePosition())
                { 
                    scrollToLine(lv.getLastVisiblePosition());
                } 
                else 
                { 
                    scrollToLine(lv.getFirstVisiblePosition() + 1);
                } 
            } 
 
            pause(); 
            return true;