Reputation: 852
I am creating a highscore list in my android app. I am returning the top ten high scores in order, and would like to auto number them so I can get them in the format:
1 name score
2 name score
3 name score
4 ...
with the ranking of the score (1,2,3,4 etc) coming from the order of the returned rows. I am using this cursor to populate a listview, so is it possible to do this as part of the query? Or is there another solution? Thanks
Upvotes: 0
Views: 261
Reputation: 7123
Are you using a CursorAdapter
? If you are, you can do this, can't you?
bindView(View view, Cursor cursor){
((TextView)view).setText(cursor.getPosition() + " " + cursor.getString(DATA_COLUMN));
}
Upvotes: 1