Loading

Thursday, June 2, 2011

column '_id' does not exist

In the exercise "A simple example using Android's SQLite database, exposes data from Cursor to a ListView", we have to add column "_id" in our database, and also include it in the queue. Why?

Because we use SimpleCursorAdapter to exposes data from a Cursor to a ListView widget. It's a subclass of android.widget.CursorAdapter. The Cursor must include a column named "_id" or this class will not work - refer to Android doc CursorAdapter.

So, we must:
- include column "_id" in database.
- include it in the queue.

Otherwise "java.lang.IllegalArgumentException: column '_id' does not exist" will be thrown!

SHARE TWEET

Thank you for reading this article column '_id' does not exist With URL http://x-tutorials.blogspot.com/2011/06/column-does-not-exist.html. Also a time to read the other articles.

0 comments:

Write your comment for this article column '_id' does not exist above!