GeeCON Prague 2014*
The moose likes Android and the fly likes LoaderManager does not find an existing _id column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "LoaderManager does not find an existing _id column" Watch "LoaderManager does not find an existing _id column" New topic
Author

LoaderManager does not find an existing _id column

Hanna Borodina
Greenhorn

Joined: Jun 15, 2013
Posts: 2
I`m currently trying to write my first ever Android application, and I`ve got an exception I have no idea how to fight. I`ve already got errors that were fixed by restarting the eclipse, but this isn`t one of them, since this method didn`t work.
Here`s a log trace:

(no, the "..." is not really there. I just use it as a marker to show that there are other things there that I considered irrelevant to the problem)

I`ve already seen this exception in this project, and I fixed the problem by renaming the primary field to "_id" as is required. The method where I got the exception the first time works correctly now. It was similar only working with another table. I checked through SQLite Database Manager - yes, all the tables have "_id" as id.
Here`s the code where the cursor loader is defined:

Here are the constants referenced there:

(Errr. The code tag seems to have turned a "_" into a space before "id". Here`s a copypaste of that line outside the tag: public static final String COLUMN_NAME_ID = "_id";)

Here`s the code of creating a table in my implementation of SQLiteOpenHelper:


I am using a support library, so I had to make the class ListFragment, although there is no need to use fragments.

I have a similar class on the previous page, and there it works correctly. Does anyone here have any idea what`s wrong?
Thanks in advance.
Hanna Borodina
Greenhorn

Joined: Jun 15, 2013
Posts: 2
I did sort of find the way around that bug. Here`s the working code:

I just added that _id column to the list of the columns getting pulled. But this is still weird.
 
GeeCON Prague 2014
 
subject: LoaderManager does not find an existing _id column