0
SimpleCursorAdapter
の実装を使用しています。これはSectionIndexer
を実装しています。ここにその一部があります:SimpleCursorAdapter.getView()のカーソルからデータを取得
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;
}
}
内部でgetView(位置)その位置のカーソルからデータにアクセスする必要があります。どうすればいいのですか?
UPD
私はthisチュートリアルを使用しています。
カーソルがこのコールの後にNULLです。 –
getItemを実装する理由はありますか?それを削除し、スーパークラスにそれを手に入れさせる – dldnh