हाय यह मैं कैसे उपयोग AlphaIndexer
private final class ContactListItemAdapter extends ResourceCursorAdapter
implements SectionIndexer {
AlphabetIndexer alphaIndexer;
public ContactListItemAdapter(Context context, int layout, Cursor c) {
super(context, layout, c);
alphaIndexer = new AlphabetIndexer(c, NAME_COLUMN_INDEX,
" ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
....
a normal getView
....
}
public int getPositionForSection(int section) {
return alphaIndexer.getPositionForSection(section);
}
public int getSectionForPosition(int position) {
return alphaIndexer.getSectionForPosition(position);
}
public Object[] getSections() {
return alphaIndexer.getSections();
}
}
NAME_COLUMN_INDEX डेटाबेस स्कीमा में स्तंभ का सूचकांक है।
...
यदि यह आप क्या जरूरत नहीं है, कुछ कोड के बारे में जो वर्ग का विस्तार और इतने पर करने के लिए किया जाना चाहिए जोड़ें।
वैसे भी मुझे उम्मीद है कि इससे मदद मिलती है।
public Cursor swapCursor(Cursor c) {
// Create our indexer
if (c != null) {
mIndexer = new AlphabetIndexer(c, c.getColumnIndex(Books.TITLE),
" ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
return super.swapCursor(c);
}
बाकी सब कुछ रहता है @vsm का वर्णन करता है बस के रूप में:
मैं यहां कुछ समान कर रहा हूं http://stackoverflow.com/questions/10224233/alphabetindexer-with-custom-adapter-managed-by-loadermanager – toobsco42
यहां मैंने एंड्रॉइड में नमूना एप्लिकेशन बनाया है, जो आईफोन अल्फाबेटिकल के समान है इंडेक्सर http://mukeshyadav4u.blogspot.in/2012/06/alphabatical-indexer-in-android.html –