Code example for AbsListView

Methods: getCount, setSelection

0
            } 
        } 
    } 
 
    private void scrollTo(float position) {
        int count = mList.getCount();
        mScrollCompleted = false;
        float fThreshold = (1.0f / count) / 8;
        final Object[] sections = mSections;
        int sectionIndex;
 
        int index = (int) (position * count);
        if (mList instanceof ListView) { // This INCLUDES ExpandableListView
            ((ListView) mList).setSelectionFromTop(index + mListOffset, 0);
        } else { 
            mList.setSelection(index + mListOffset);
        } 
        if (sections != null && sections.length > 1) {
            sectionIndex = mSectionIndexer.getSectionForPosition(index);
        } else 
            sectionIndex = -1;