0

所以我有一个从字典中获取所有单词的简单方法:

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 不会进入(光标里什么都没有)。我究竟做错了什么?

4

1 回答 1

-1

尝试将您的投影列表仅限制为 UserDictionary.Words._ID 一项

或将 null 作为投影参数

于 2014-07-19T01:22:44.470 回答