in my database having some row’s , in every row having three column’s(id, name, moves, time). i want to sort the rows depending on the moves this is the integer value.
i tried like this but unlucky.
public Cursor fetchAllNotes() {
return db.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_NAME,
KEY_MOVES,KEY_TIME}, null, null, null, null, KEY_MOVES);
}
used like this
private void getallrows() {
// get all the contacts..
db.open();
Cursor c = db.fetchAllNotes();
if (c.moveToFirst()) {
do {
Sorting(c);
} while (c.moveToNext());
}
db.close();
}
moves i have like 15, 45, 21, 11, 10,75,33
i want like this 10,11,15,21,33,45,75
Try this –
or
EDIT – 1:
If you want to display name,you can use like this,