class MyCursorAdapter extends SimpleCursorAdapter implements SectionIndexer {
AlphabetIndexer alphaIndexer;
public MyCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to) {
super(context, layout, c, from, to);
alphaIndexer = new AlphabetIndexer(c,
c.getColumnIndex(Dbasehelper.COL_WORD),
" ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
@Override
public int getPositionForSection(int section) {
return alphaIndexer.getPositionForSection(section); // use the
// indexer
}
@Override
public int getSectionForPosition(int position) {
return alphaIndexer.getSectionForPosition(position); // use the
// indexer
}
@Override
public Object[] getSections() {
return alphaIndexer.getSections(); // use the indexer
}
}
No comments:
Post a Comment