나는 접근성 응용 프로그램을 제작 중이며 사용자가 스크롤 할 때 AlphabetIndexer의 현재 문자를 크게 읽으 려합니다.현재 편지 가져 오기 onScroll?
어떻게하면 일부 코드를 실행할 수 있습니까? 그리고 CursorAdapter 안에 현재의 편지를 어떻게 얻습니까?
감사
이 내가 노력하고있어입니다 (난 단지 관련 비트를 떠나 시도) :
@Override
public int getPositionForSection(int section)
{
int result = super.getPositionForSection(section);
Log.i("TAG", "getPositionForSection " + result);
return result;
}
:
private class ContactsAdapter extends CursorAdapter implements SectionIndexer {
private LayoutInflater mInflater;
private AlphabetIndexer mAlphabetIndexer;
public ContactsAdapter(Context context) {
super(context, null, 0);
mInflater = LayoutInflater.from(context);
final String alphabet = context.getString(R.string.alphabet);
mAlphabetIndexer = new AlphabetIndexer(null, ContactsQuery.SORT_KEY, alphabet);
}
// ...
@Override
public Object[] getSections() {
return mAlphabetIndexer.getSections();
}
@Override
public int getPositionForSection(int i) {
if (getCursor() == null) {
return 0;
}
Log.i("TAG", "getPositionForSection " + mAlphabetIndexer.getPositionForSection(i));
return mAlphabetIndexer.getPositionForSection(i);
}
@Override
public int getSectionForPosition(int i) {
if (getCursor() == null) {
return 0;
}
return mAlphabetIndexer.getSectionForPosition(i);
}
}
방금 시도했지만 정상적으로 작동하지만 'ArrayIndexOutOfBoundsException' 메시지로 무작위로 충돌합니다. – lisovaccaro
'[i] '대신'[mAlphabetIndexer.getSectionForPosition (i)] '이 (가) 문제를 발견했습니다. – lisovaccaro
죄송합니다. . 내 부분에 대해 약간의 감독. 편집 해 주셔서 감사합니다. – adneal