Fix AlphabetIndexer.getSectionForPosition()

This did not properly set the cursor position before reading, which
resulted in wrong return values or exceptions in the cursor.
This commit is contained in:
Phil Dubach
2009-06-05 12:27:59 -07:00
parent 85dfec8c35
commit 1b111bb6e2

View File

@@ -248,8 +248,8 @@ public class AlphabetIndexer extends DataSetObserver implements SectionIndexer {
public int getSectionForPosition(int position) {
int savedCursorPos = mDataCursor.getPosition();
mDataCursor.moveToPosition(position);
mDataCursor.moveToPosition(savedCursorPos);
String curName = mDataCursor.getString(mColumnIndex);
mDataCursor.moveToPosition(savedCursorPos);
// Linear search, as there are only a few items in the section index
// Could speed this up later if it actually gets used.
for (int i = 0; i < mAlphabetLength; i++) {