Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

LoaderManager does not find an existing _id column

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic