KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having trouble with something that works in the Notepad example. Here's the code from the NotepadCodeLab/Notepadv1Solution: String[] from = new String[] { NotesDbAdapter.KEY_TITLE }; int[] to = new int[] { R.id.text1 }; SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to); This code seems to work fine. But just to be clear, I ran the ADB utility and run SQLite 3. I inspected the schema as follows: sqlite> .schema CREATE TABLE android_metadata (locale TEXT); CREATE TABLE notes (_id integer primary key autoincrement, title text not null, body text not null); All seems good to me. Now on to my application, which, as far as I can see, is basically the same with a few minor changes. I've simplified and simplified my code, but the problem persists. String[] from = new String[] { "x" }; int[] to = new int[] { R.id.x }; SimpleCursorAdapter adapter = null; try { adapter = new SimpleCursorAdapter(this, R.layout.circle_row, cursor, from, to); } catch (RuntimeException e) { Log.e("Circle", e.toString(), e); } When I run my application, I get a RuntimeException and the following prints in LogCat from my Log.e() statement: LogCat Message: java.lang.IllegalArgumentException: column '_id' does not exist So, back to SQLite 3 to see what's different about my schema: sqlite> .schema CREATE TABLE android_metadata (locale TEXT); CREATE TABLE circles (_id integer primary key autoincrement, sequence integer, radius real, x real, y real); I don't see how I'm missing the '_id'. What have I done wrong? One thing that's different between my application and the Notepad example is that I started by creating my application from scratch using th
Tags (comma-separated)
Save Edits
Cancel