4

如何获得仅包含Category模型的“名称”列的数组?

我可以使用我的所有类别

List<Category> categoryList = new Select()
    .from(Category.class)
    .execute();

然后创建另一个名称为 的数组Category,但我想有一种方法可以直接获取它,但我找不到方法。

4

1 回答 1

12

回答这个问题有点晚了,但问题是因为 SQLiteUtils.rawQuery() 假设 Id 列总是在游标结果中。将列 String[] 设置为 {Id, your_column} 就可以了。

List<Category> categoryList = new Select(new String[]{"Id,your_column"}).from(Category.class).execute();
于 2015-03-13T18:27:38.143 回答