Reputation: 33
I am using a content provider and need to query a table where one column of the row = thing1 and another column of that same row = thing2. i know you can query a table for just one condition like:
Cursor c = contentResolver.query(content_uri, projection, variable + "='" + thing1 + "'", null, null);
now how can i query for two conditions? any help would be appreciated.
Upvotes: 0
Views: 834
Reputation: 1006584
This should work:
Cursor c = contentResolver.query(content_uri, projection, "col1=? AND col2=?", args, null);
where args
is a String[]
of values to substitute in for the ?
in the query.
Upvotes: 5
Reputation: 3776
Try this
Cursor c = contentResolver.query(content_uri, projection, variable + "='" + thing1 + "' AND "+variable2 + "='"+thing2+"'" , null, null);
Upvotes: 0