I'm looking at the Notes app example from the Android SDK. What I want to learn how to do is instead of using a CursorAdapter to just pass to a ListAdpater/ListView to sort out, I want to know how I can deal with the data myself; particularly in an ArrayList form.
In the example, a note basically has an id, title, and body. I want to know how I can query the SQLite database and use the cursor it returns to collect the data and create object instances of an object I'll call Note which has parameters for id, title, and body. I ultimately want to store all these objects into an ArrayList for management. I'm just not sure how to deal with a Cursor.
This is a pretty general question but I just need someone to point me in the right direction.
Actually I figured it out myself after playing around. So I realized that using cursor.getColumnIndex("name_of_column")
will return the column's index to be used in commands like cursor.getInt(cursor.getColumnIndex("_id"));
. All I have to do is just use a for loop to go through the whole list and use cursor.moveToNext()
to just iterate through the rows collected. I came up with this minutes after I posted this question. :)