Rearrange list view items in SimpleCursorAdapter

前端 未结 2 1314
天命终不由人
天命终不由人 2021-01-22 16:32

I have a database SQLite and then using SimpleCursorAdapter , I display values into list view. However, I want to re arrange the list view items and display the ones starting wi

相关标签:
2条回答
  • 2021-01-22 17:29

    If you are using SQLite correctly you should be able to do a "order by id" when you query up the DB.

    If thats not the case then what I would do is build out your data into a collection.

    Have your generic object implement the comparable interface.

    like so http://www.java-tips.org/java-se-tips/java.lang/how-to-use-comparable-interface.html

    When you call Collections.sort(contentfromtheprovider); It will sort based on the ID like you wish to do.

    0 讨论(0)
  • 2021-01-22 17:32

    just format your query, here's the page that helped me.

    http://msdn.microsoft.com/en-us/library/bb264565%28v=sql.90%29.aspx

    0 讨论(0)
提交回复
热议问题