plusmoDroid
Lurker
I've been looking this notepad example, and I want to try print the contents of the database on a screen widget.
What I'm trying to figure out, is how to handle the cursor to have direct access to the database data.
Could someone help me, how to do this?
What I'm trying to figure out, is how to handle the cursor to have direct access to the database data.
Could someone help me, how to do this?
Code:
private void fillData() {
// Get all of the notes from the database and create the item list
Cursor c = mDbHelper.fetchAllNotes();
startManagingCursor(c);
String[] from = new String[] { NotesDbAdapter.KEY_TITLE };
int[] to = new int[] { R.id.text1 };
// Now create an array adapter and set it to display using our row
SimpleCursorAdapter notes =
new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
setListAdapter(notes);
}