Reputation:
I'm using implementation of SimpleCursorAdapter
, which implements SectionIndexer
. Here's part of it:
public class MyAlphabetizedAdapter extends SimpleCursorAdapter implements
SectionIndexer {
public ContactAlphabetizedAdapter(Context context, int layout,
Cursor cursor, String[] from, int[] to) {
mIndexer = new AlphabetIndexer(cursor, cursor.getColumnIndexOrThrow(ContactsContract.Data.DISPLAY_NAME), sAlphabet);
}
@Override
public Object getItem(int position) {
if (getItemViewType(position) == TYPE_NORMAL) {
return super
.getItem(position
- mSectionToOffset
.get(getSectionForPosition(position)) - 1);
}
return null;
}
}
Inside getView(position) I need to access data from cursor for that position. How do I do it?
UPD
I'm using this tutorial.
Upvotes: 0
Views: 3260
Reputation: 8951
try this:
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
...
Cursor cursor = (Cursor) getItem(position);
}
Upvotes: 8