所以我有一个从字典中获取所有单词的简单方法:
public static void getFromDictionary(Activity a) {
System.out.println("Inside getFromDictionary");
ContentResolver resolver = a
.getContentResolver();
String[] projection = new String[] { UserDictionary.Words._ID,
UserDictionary.Words.WORD, UserDictionary.Words.FREQUENCY };
Cursor cursor = resolver.query(UserDictionary.Words.CONTENT_URI,
projection, null, null, null);
while (cursor.moveToNext()) {
String word = cursor.getString(1);
Log.e("DICCIONARIO", word);
}
}
嗯,我在不同的手机上试过了,while bucle 不会进入(光标里什么都没有)。我究竟做错了什么?