mardi 13 octobre 2015

SQLite sort by integer value

I'm using ActiveAndroid library. I need to get a list of my objects sorted by the integer field. here is how I'm trying to do that:

public static List<Category> getCategories() {
        try {
            return new Select()
                    .all()
                    .from(Category.class)
                    .orderBy("NumInRow ASC") // NumInRow is my int field
                    .execute();
        } catch (Exception ignored) {
            return null;
        }
    }

Am I right?

Aucun commentaire:

Enregistrer un commentaire