Can't manage an instance of Cursor for my SQLite database
开发者_如何学编程I've successfully copied an existing SQLite database to android, as it was recommended here http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ and now when i'm writing
Cursor cur = db.db.query("student", null, null, null, null, null, null);
The app breaks trying to create a cursor. I'm sure there is a "student" table. Could you help me with suggesting any reasons of why this happens, please?
I just guessing, but db.db.query()
looks wrong... you sure you didn't mean db.query()
?
A more collaborative answer than my comment. I would think you'll be fine by doing something like this tutorial does http://droidreign.com/2010/10/dev-tutorials-android-sqlite-database-basics/ . About half the way down is the part you are looking for.
Edit: I guess the problem with your query is that you ask for none of the columns (second parameter in your query). It should probably be at least one of your columns.
精彩评论