안녕하세요.
리스트 뷰에서 빠르게 검색할 수 있게 하려고하는데요.
아래와 같이
1. implements SectionIndexer
2. listview.setFastScrollEnabled(true);
3. 그리고 각 데이터의 초성을
아래와 같이 넣었습니다. 초성이 정상적으로 들어간 것은 확인 했습니다.
Set<String> keys = alphaIndexer.keySet();
Iterator<String> it = keys.iterator();
ArrayList<String> keyList = new ArrayList<String>();
while (it.hasNext()) {
String key = it.next();
keyList.add(key);
}
Collections.sort(keyList);
sections = new String[keyList.size()];
keyList.toArray(sections);
4. 문제는 여기입니다. 스크롤시 오버라이드 된 getPositionForSection() 함수가 동작 되서 초성이 나타나야하는데
나타나지가 않습니다.ㅠㅠ
@Override
public int getPositionForSection(int section) {
// TODO Auto-generated method stub
String letter = sections[section];
return alphaIndexer.get(letter);
}
@Override
public int getSectionForPosition(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public Object[] getSections() {
// TODO Auto-generated method stub
return null;
}
문제점이 있다면 알려주세요^^:;