last day (18 days later) » 

8:33 PM
0
Q: ListView working with database in android

user3091082I asked a similar question before but wasn't sure how to word it. I have since looked at some tutorials and have a little more understanding of my problem. I am trying to display information from my database into a list view but can't figure out how to make it work. Any help would be great. Thi...

 
what is the problem ? application crashed? nothing display? what is size of your cursor ? .....
 
No this code does not work. The app crashes when i try to use it.
I am still new to this so how exactly do i get the stacktrace? thanks for trying to help
Ok thanks i will try post it soon
I have added a stacktrace. it seems to be a problem with the id column?
 
yes, change id with _id
 
in the database adapter class?
 
in DBAdapter change create table statement and change KEY_ROWID
 
8:33 PM
I tried that and got this error message Caused by: android.database.sqlite.SQLiteException: no such column: _id (code 1): , while compiling: SELECT _id, title, workoutDate, notes FROM workouts
 
did you change create table statement? if yes uninstall application and install again
 
private static final String DATABASE_CREATE = "create table if not exists workouts " + "(_id integer primary key autoincrement, " + "title VARCHAR not null, " + "workoutDate date, " + "notes VARCHAR );"; This is the create table statement yes?
 
yes, uninstall application and run again
 
I tried that and got a new error, java.lang.RuntimeException: Unable to start activity ComponentInfo{course.labs.todomanager/course.labs.todomanager.AndroidListViewCur‌​‌​sorAdaptorActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ListView.setAdapter(android.widget.ListAdapter)' on a null object reference
do you have any idea what this means?
 

  last day (18 days later) »