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 内部的问题,我该如何解决?