Reputation: 18130
I have everything working in my DBHelper class except for my fetch statement. I get a red line under query. What am I doing wrong here?
public Cursor fetchAllItems() {
return mDb.query(DATABASE_TABLE, new String[] { KEY_ITEM, KEY_PRIORITY,
KEY_ROWID }, null, null);
}
Upvotes: 1
Views: 89
Reputation: 6108
public Cursor fetchAllItems() {
return mDb.query(DATABASE_TABLE, new String[] { KEY_ITEM, KEY_PRIORITY,
KEY_ROWID }, null, null, null, null, null);
}
You may also read the API reference here regarding database. You can see all the available functions there.
Upvotes: 0
Reputation: 68177
Seems like you are missing to provide some extra null
. See below:
public Cursor fetchAllItems() {
return mDb.query(DATABASE_TABLE, new String[] {KEY_ITEM, KEY_PRIORITY,
KEY_ROWID}, null, null, null, null, null);
}
For more info, read the docs.
Upvotes: 2
Reputation: 1893
public Cursor fetchAllItems() {
return mDb.query("", new String[] { KEY_ITEM, KEY_PRIORITY,
KEY_ROWID }, "", null, "", null, null);
}
This will work
Upvotes: 0