I need to display list of 10 best scores. I used this code to get the data and put it in a arraylist
private ArrayList<String> getData() {
String[] columns = {DbHelper.COL_NAME, DbHelper.COL_SCORE};
Cursor c = db.query(DbHelper.TABLE_NAME, columns, null, null, null, null, DbHelper.COL_SCORE, "10");
int nameCol = c.getColumnIndex(DbHelper.COL_NAME);
int scoreCol = c.getColumnIndex(DbHelper.COL_SCORE);
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
scoresList.add(c.getString(nameCol) + " " + c.getString(scoreCol));
}
return scoresList;
}
The only problem that its ordered from the lowest score to the highest, and i need it reversed.
ORDER BY Score DESCclause (by default, theORDER BYstatement operates as if you specifiedASC)