I want to store history data in a sqlite db.
a max of 20 “entries” should be secured.
when adding a new entrie the oldest should be deleted and the new one added at the begining of the list.
when calling the histroy i want it to be shown in reversed order (latest entry first)
as far as i know that functionality is not possible with a cursor by itself. i will need to convert the cursor i call into another MAP type. the question is which one and how to realize that actions.
That should not be that hard. Your table for the history needs an id column. It is also mandatory when working with cursors and adapters. Define the id column as auto incremented. So every time you insert a new row into the table the new row gets automatically an unique id which is higher than the last id that was assigned to row that was inserted before.
You must write a method which you call when you want to add a new entry to the database. Within the method you do the following.
When you want to display the entries in a list using a cursor you can define the order of the returned rows by the SQL command order by.