aspose file tools*
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

LoaderManager does not find an existing _id column

Hanna Borodina

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

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.
It is sorta covered in the JavaRanch Style Guide.
subject: LoaderManager does not find an existing _id column
Similar Threads
Newbie learning sprites in android java
File path to FileList.txt and xml files not working
Android app force closes on a real device but works on emulator
How to get info from List Fragment item
how to transfer images to ftp server in android