1 message in com.googlegroups.android-developersPlease update the Notepad examples wi...| From | Sent On | Attachments |
|---|---|---|
| Fred Janon | 29 Mar 2008 03:11 |
| Subject: | Please update the Notepad examples with "android.provider.BaseColumns._ID" (was: Bad request for field slot 0,-1.)![]() |
|---|---|
| From: | Fred Janon (fja...@gmail.com) |
| Date: | 03/29/2008 03:11:02 AM |
| List: | com.googlegroups.android-developers |
I just wasted 5 days for the challenge banging my head trying to figure out why a database that worked with SQLite on Windows would not work on Android. Since we don't have access to the SDK source, I couldn't find the source of the error message: "Bad request for field slot 0,-1". I finally figured out that a table primary key MUST be named "_id" in Android (mine are called ID generally or LINKID depending on the table). (see Note 4. in"Accessing Content Providers" and "android.widget.CursorAdapter: The Cursor must include a column named "_id" or this class will not work". I think that first the example source *SHOULD NOT* use an "_id" but " android.provider.BaseColumns._ID" with a warning and an explanation that the primary key MUST be named that way. It also should be in the sqlite Javadocs, that's where I would have expected them to be.
The "Notepad Tutorial" should have something like: "The primary key MUST be named "_id" and not " _id is named in line with a convention...".
I also think that having such a constraint on all tables is very restrictive and not a very good design practice.
Fred
On Tue, Mar 25, 2008 at 7:34 PM, Fred Janon <fja...@gmail.com> wrote:
Would anyone be kind enough to tell me in what direction I should investigate? Does this error mean that my mapping "from" or "to" is wrong or is it my SQL query? I checked and rechecked all of that and could not find anything. Apr 14 is approaching way too quickly.
Thanks
Fred
---------- Forwarded message ---------- From: Fred Janon <fja...@gmail.com> Date: Mon, Mar 24, 2008 at 4:26 PM Subject: ListActivity/SimpleCursorAdapter/SQLite issue: ERROR/CursorWindow(728): Bad request for field slot 0,-1. To: andr...@googlegroups.com
during a setListAdapter call:
SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.notes_row, notesCursor, from, to); setListAdapter(notes);
I get this error:
ERROR/CursorWindow(728): Bad request for field slot 0,-1. numRows = 1, numColumns = 3
What does this mean: "slot 0, -1"? Where is the issue?
Thanks
Fred




