IllegalStateException in getSectionForPosition use in an indexed list adapter on Nexus S
<p>This is the constructor of my indexed custom SimpleCursorAdapter : </p>

<pre><code>public myAdapter(Context context, int layout, Cursor c,
        String[] from, int[] to, Activity activity) {
    super(context, layout, c, from, to);

    this.context = context;
    this.currentCursor = c;
    this.activity = activity;

    indexer = new AlphabetIndexer(c, c.getColumnIndexOrThrow("CARD_title"), "-ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    sectionToPosition = new TreeMap&lt;Integer, Integer&gt;();
    sectionToOffset = new HashMap&lt;Integer, Integer&gt;();

    final int count = super.getCount();

    int i;
    for (i = count - 1 ; i &gt;= 0; i--){
        try {
            int tmp = indexer.getSectionForPosition(i);
            sectionToPosition.put(tmp, i);
        } catch (IllegalStateException e) {
            Log.e("LIST_ADAPTER", "error = " + e);
        } catch (CursorIndexOutOfBoundsException e) {
            Log.e("LIST_ADAPTER", "error = " + e);
        }
    }

    i = 0;
    usedSectionNumbers = new int[sectionToPosition.keySet().size()];

    for (Integer section : sectionToPosition.keySet()){
        sectionToOffset.put(section, i);
        usedSectionNumbers[i] = section;
        i++;
    }

    for(Integer section: sectionToPosition.keySet()){
        sectionToPosition.put(section, sectionToPosition.get(section) + sectionToOffset.get(section));
    }


}
</code></pre>

<p>The issue is that I always get an IllegalStateException in line :
int tmp = indexer.getSectionForPosition(i);
It only appears in my nexus S android 2.3.6 and the same instruction works great in any other devices.
This is the complete log I got:</p>

<pre><code>03-12 19:43:37.496: E/CursorWindow(3021): need to grow: mSize = 1048576, size = 4203, freeSpace() = 2620, numRows = 251
03-12 19:43:37.496: E/CursorWindow(3021): not growing since there are already 251 row(s), max size 1048576
03-12 19:43:37.500: E/Cursor(3021): Failed allocating 4203 bytes for blob at 250,7
03-12 19:43:37.542: E/Cursor(3021): Invalid statement in fillWindow()
03-12 19:43:37.542: E/CursorWindow(3021): Bad request for field slot 0,0. numRows = 0, numColumns = 0
03-12 19:43:37.546: E/AndroidRuntime(3021): FATAL EXCEPTION: main
03-12 19:43:37.546: E/AndroidRuntime(3021): java.lang.IllegalStateException: get field slot from row 0 col 0 failed
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.database.CursorWindow.getLong_native(Native Method)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.database.CursorWindow.getLong(CursorWindow.java:380)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:108)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:194)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.widget.AlphabetIndexer.getSectionForPosition(AlphabetIndexer.java:257)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at com.myApp.novactive.adapter.CardsByNameAdapter.&lt;init&gt;(CardsByNameAdapter.java:88)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at com.myApp.novactive.ListCards$ExtractData$2.run(ListCards.java:392)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.os.Handler.handleCallback(Handler.java:587)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.os.Looper.loop(Looper.java:130)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at android.app.ActivityThread.main(ActivityThread.java:3683)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at java.lang.reflect.Method.invokeNative(Native Method)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at java.lang.reflect.Method.invoke(Method.java:507)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-12 19:43:37.546: E/AndroidRuntime(3021):     at dalvik.system.NativeStart.main(Native Method)
03-12 19:43:40.066: E/CursorWindow(3021): need to grow: mSize = 1048576, size = 4203, freeSpace() = 938, numRows = 252
03-12 19:43:40.066: E/CursorWindow(3021): not growing since there are already 252 row(s), max size 1048576
03-12 19:43:40.066: E/Cursor(3021): Failed allocating 4203 bytes for blob at 251,7
</code></pre>

<p>An idea? Thanks!</p>
