From 1b111bb6e2a570fe5f88d018fb3ec3c1ae880dcc Mon Sep 17 00:00:00 2001 From: Phil Dubach Date: Fri, 5 Jun 2009 12:27:59 -0700 Subject: Fix AlphabetIndexer.getSectionForPosition() This did not properly set the cursor position before reading, which resulted in wrong return values or exceptions in the cursor. --- core/java/android/widget/AlphabetIndexer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/java') diff --git a/core/java/android/widget/AlphabetIndexer.java b/core/java/android/widget/AlphabetIndexer.java index 4e466a0..f50676a 100644 --- a/core/java/android/widget/AlphabetIndexer.java +++ b/core/java/android/widget/AlphabetIndexer.java @@ -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++) { -- cgit v1.1