I am building an app that creates and communicates with an SQLite database.
However, each time the app makes a connection with the database, it shuts down due to errors.
The (in my eyes) relevant errors are these:
03-21 07:50:29.308: E/AndroidRuntime(554): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dummies.android.taskreminder/com.dummies.android.taskreminder.ReminderListActivity}: java.lang.IllegalArgumentException: column '_id' does not exist
03-21 07:50:29.308: E/AndroidRuntime(554): Caused by: java.lang.IllegalArgumentException: column '_id' does not exist
In the tutorial I used, the ID column is named “_id” but i renamed it to “ReminderID” before ever using it. The term “_id” is never used in my version and renaming the variable “ReminderID” to “_id” gives me the same errors.
Your database doesn’t have to have a column called ‘_id’ but the SimpleCursorAdaptor does need to have one returned. You can do this with an alias.
_id field is used as a unique key to make sure the data the cursor handles can be handled correctly by adapters and adapterviews etc.
if
To query for your SimpleCursorAdapter, you can do this with a database rawQuery…