Code example for AlphabetIndexer

0
public final class AppCursorAdapter extends SimpleCursorAdapter implements SectionIndexer {
	private final AlphabetIndexer alphaIndexer;
 
	public AppCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) {
		super(context, layout, c, from, to);
		alphaIndexer = new AlphabetIndexer(c, 1, " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
	} 
 
	public int getPositionForSection(int section) {
		return alphaIndexer.getPositionForSection(section);
	} 
 
	public int getSectionForPosition(int position) {
		return alphaIndexer.getSectionForPosition(position);
	} 
 
	public Object[] getSections() {
		return alphaIndexer.getSections();
	} 
 
}