In my project I have class that extends ArrayAdapter<String> and implements SectionIndexer. When implementing methods getPositionForSection and getSectionForPosition I have found some strange behaviour.
Why section indexer works properly when getSectionForPosition returns 0?
public int getSectionForPosition(int position) {
return 0;
}
this implementation is used in many tutorials, for example:
http://androidopentutorials.com/android-listview-fastscroll/
http://www.survivingwithandroid.com/2012/12/android-listview-sectionindexer-fastscroll.html
Documentation says that
Given a position within the adapter, returns the index of the corresponding section within the array of section objects.
so if my list have 5 items starting with letter "A" and some items starting with letter "B", then getSectionForPosition(5) should return 1.