How to get only one column as a result of a query with ActiveAndroid?

How do I get an array with only the "Name" column of my model Category?

I can get all my categories using

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

and then create another array with the name Category, but I think there is a way to get it directly, and I cannot find it.

+4
source share
1 answer

A bit late in response to this, but the problem is that SQLiteUtils.rawQuery () makes the assumption that the identifier column will always be in the cursor results. Set the String [] columns to {Id, your_column} and everything will be fine.

    List<Category> categoryList = new Select(new String[]{"Id,your_column"}).from(Category.class).execute();
+12
source

All Articles