Android : SQLite multiple query selection OR

on Monday, November 10, 2014


Hey there are plenty of answers regarding multiple selection queries and I've read through all that i could find. My query seems correct to me but i can only get it working with one selection. Hopefully another pair of eyes can notice what i'm missing.



Cursor getSearch(String itemName) {
String searchSelect = "( "+MediaStore.Audio.Media.TITLE + " LIKE ? OR"+
MediaStore.Audio.Media.ARTIST + " LIKE ? OR"+
MediaStore.Audio.Media.ALBUM + " LIKE ? )";
String[] selectArgs = { "%" + itemName + "%"};
Cursor searchCursor = getContentResolver().query(
queryUri,
projection,
searchSelect,
selectArgs,
MediaStore.Audio.Media.TITLE + " ASC"
);
return searchCursor;
}

0 comments:

Post a Comment