How do I add an AND to my WHERE clause in an Android Cursor?
For example:
Cursor cursor = data.query(
Banana.URI,
new String[]{BananaColumns._ID},
BananaColumns.NAME + "=? AND " + BananaColumns.COLLECTION + "=?",
new String[]{bananaData.getName(), bananaData.getCategory()},
null);
This returns an empty Cursor. But the Table contains data that should be found by that query. Is my formatting wrong?
Thanks
The query looks fine to me if you want:
SELECT _id FROM BananaTable WHERE name=<bananaData.getName()> AND collection=<bananaData.getCategory()>. (I made a few assumptions on the names.) Double check that the bananaData methods return what you expect.