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 with ID #1 in top and then ID number 2, so on.. the issue is, I am not able to grasp concept of re allocating list view items based on some ID number from Content provider. If you know , please share. Thank you.
            Asked
            
        
        
            Active
            
        
            Viewed 1,423 times
        
    2
            
            
        - 
                    1Without any code it's difficult to comment but basically you need to provide some kind of 'sort order' when you query the provider. – Squonk Mar 27 '12 at 22:26
 
2 Answers
3
            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.
        JakeWilson801
        
- 1,036
 - 7
 - 20
 
2
            
            
        just format your query, here's the page that helped me.
http://msdn.microsoft.com/en-us/library/bb264565%28v=sql.90%29.aspx
        Bill Gary
        
- 2,987
 - 2
 - 15
 - 19