I'm having a hard time here with AlphabetIndexer here. I'm trying to use it to produce sectioned listview:
private static final String sAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
private AlphabetIndexer mIndexer;
public ContactAlphabetizedAdapter(Context context, int layout,
Cursor cursor, String[] from, int[] to) {
super(context, layout, cursor, from, to);
mIndexer = new AlphabetIndexer(cursor, cursor.getColumnIndexOrThrow(ContactsContract.Data.DISPLAY_NAME), sAlphabet);
私のデバイスでアプリがクラッシュし、問題は次のとおりです。
E/AndroidRuntime(5188): Caused by: java.lang.NullPointerException
E/AndroidRuntime(5188): at android.widget.AlphabetIndexer.compare(AlphabetIndexer.java:128)
E/AndroidRuntime(5188): at android.widget.AlphabetIndexer.getSectionForPosition(AlphabetIndexer.java:265)
これはAlphabetIndexerの内部にとっては何かですが、これを修正するにはどうすればよいですか?