10
I use a cursor to return items for a media based Listview. I would like to only return items that are in a specific folder.
This works for my Song list, as this cursor is based off MediaStore.Audio.Media.DATA, and I can check this for the folder in the cursor:
final String folder = "'" + (new MyPrefs(this.PREF_PATH)).getString("music_folder",null) + "%'";
audioCursor = getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, mCursorCols,
MediaStore.Audio.Media.DATA + " LIKE " + folder, null,MediaColumns.TITLE + " COLLATE LOCALIZED ASC");
startManagingCursor(audioCursor);
However, in my Listview for artists, the DATA result is not available to check against:
audioCursor = getContentResolver().query(MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, cols,
null, null,AudioColumns.ARTIST + " COLLATE LOCALIZED ASC");
startManagingCursor(audioCursor);
Can anyone please share with me a good method for querying the MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI and only returning my specific folder? I need to use the Artist URI because I use the NUMBER_OF_TRACKS column, which is not available in the regular Media URI.