开发者

Sorting Sqlite data while display

I have "date"(TEXT) column in db.I want to display dates in ascending order(i.e. group by date).but according to current date. i.e dates greator or equal t开发者_如何学Gohan current date should be displayed first and past dates should get appended at last in listview automatically.I used SimpleCursorAdapter to display list.

So how should I do this?


Write the proper query and you should be fine. If you are looking for that particular query as an answer to your question, tag it as sql or sqlite as well.


You can sort data items when you try to query..here a cursor object set with parameters(just an example),the 7th parameter With "ASC" means that the return data will be in ascending oder

cursor cur = yourdata.query(TableName, coloumns, null, null,null, null, table.COLUMN_NAME + " ASC");

if you want an example you can try this code example Click me

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜