AlphabetIndexer with Custom Adapter managed by LoaderManager

So I finally got this to work. Here’s how i did it:

I added:

ListView lv = getListView();
lv.setFastScrollEnabled(true);
lv.setScrollingCacheEnabled(true);

to the onLoadFinished() method after the new cursor was swapped in like so

public void onLoadFinished(Loader<Cursor> loader, Cursor data) { 
 // Swap the new cursor in.  (The framework will take care of closing the
 // old cursor once we return.)
 mAdapter.swapCursor(data);

 ListView lv = getListView();
 lv.setFastScrollEnabled(true);
 lv.setScrollingCacheEnabled(true);

}

consequently these three statements were removed from the onActivityCreated() method of my custom ListFragment.

Leave a Comment