alphabetic indexer in android
I have a list view populated from the database, I have my scroll view with FastScroll enabled, the scroll bar is showing the widget but the indexing is not worki开发者_运维问答ng can any one help?
Take a look at this post..AlphabetizedAdapter..
Take a look at this post. This will help you.
According to AlphabetIndexer Documentation, an AlphabetIndexer is:
A helper class for adapters that implement the SectionIndexer interface. If the items in the adapter are sorted by simple alphabet-based sorting, then this class provides a way to do fast indexing of large lists using binary search. It caches the indices that have been determined through the binary search and also invalidates the cache if changes occur in the cursor.Your adapter is responsible for updating the cursor by calling
setCursor(Cursor)
if the cursor changes.getPositionForSection(int)
method does the binary search for the starting index of a given section (alphabet).
So you might consider using a Cursor Adapter and implement a Section Indexer.
精彩评论