I gave an sqlite database and I want to query the database ordered by name.
I heard that you can do this by the orderBy part in the db.query code. So I did it like this where KEY_NAME is supposed to sort it by name. For some reason this doesn't work. Anybody know why?
// Return all data in the database.
public Cursor getAllRows() {
Cursor c = db.query(true, DATABASE_TABLE, ALL_KEYS, null, null, null, null, KEY_NAME, null);
if (c != null) {
c.moveToFirst();
}
return c;
}
Aucun commentaire:
Enregistrer un commentaire