Search code examples
androidsqlnotepad

Android Notepad Tutorial extension: getting more out of the (SQL) NotesDatabase


Confused beginner here.

I'm extending the functionality of the android notepad tutorial program. I can successfully get the data from the sql to display in a list view and I can use the findNote function to get an individual note.

What I want to be able to do is extract an individual note AND all following notes in the table. I'd be happy with some way to iterate through the remaining notes (a puzzle for me because the rowIds are not sequential) but would also settle for designing a query that... I don't know, returns a String[] with the item with the matching id at position 0 and all subsequent items later in the array.

I'm sure there are a thousand ways to do this, I'm willing to take almost any of them. Please let me know if I need to clarify further.


Solution

  • Just looking at the NotesDbAdapter class in that tutorial, there doesn't appear to be any timestamp captured with the notes. You would need to extend the table structure to include this and update the createNote and updateNote methods to set that accordingly. Then you can write your SQL based upon that timestamp.

    John