Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6385743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:56:17+00:00 2026-05-25T02:56:17+00:00

Somehow while debugging a little Location based android app I get a strange exception.

  • 0

Somehow while debugging a little Location based android app I get a strange exception. Have a look and share your ideas:

I have connected a ListActivity with an sqlite3 database through a ContentProvider. Now always when I start the ListActivity the program dies with an Exception telling me

column '_id' does not exist

(without a table name) for the line where I create the SimpleCursorAdapter object for my ListActivity.

    Cursor cursor = managedQuery(intent.getData(), new String[] {TrackTable.START_LOC, TrackTable.END_LOC}, null, null,
            TrackTable.DEFAULT_SORT_ORDER);
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
            R.layout.gps_track_entry, cursor, new String[] {
                    TrackTable.COLUMN_NAME_TIME_START,
                    TrackTable.COLUMN_NAME_TIME_END
                }, new int[] { R.id.l_start, R.id.l_end });

My database looks like that:

sqlite> .tables
.tables
android_metadata ocation track
sqlite> . schema track
.schema track
CREATE TABLE track (
  _id INTEGER PRIMARY KEY,
  start_location INTEGER,
  end_location INTEGER,
  start_time TEXT,
  end_time TEXT
);
sqlite> .schema location
.schema location
CREATE TABLE location (
  _id INTEGER PRIMARY KEY,
  long TEXT,
  lat TEXT,
  alt TEXT,
  accu TEXT,
  bear TEXT,
  sped TEXT,
  time TEXT);
sqlite> .schema android_metadata
.schema android_metadata
CREATE TABLE android_metadata (locale TEXT);

I mean, it is quite unlikely that the mistake is an Android bug, but it definitely looks like one, because the only table without an _id is the android_metadata. But maybe I wrote something in a strange way, that the VM now thinks I want to use android_metadata and not track, which I actually want to use.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:56:18+00:00Added an answer on May 25, 2026 at 2:56 am

    Erich is right above; the problem is that your SELECT query needs to include BaseColumns._ID as part of the projection. Something like:

    Cursor cursor = getContentResolver().query(TrackTable.CONTENT_URI, 
            new String[] { TrackTable._ID, TrackTable.COLUMN_NAME_TIME_START,
            TrackTable.COLUMN_NAME_TIME_END }, null, null, null);
    

    BTW, see the javadoc for CursorAdapter:

    The Cursor must include a column named “_id” or this class will not work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.