Reputation: 2053
How can I query multiple specified file types when querying the MediaStore?
I have successfully set up querying only mp3 files with a specifed meme type but I would like to know how I can do more than 1.
Here's what I am doing to query only 1 file type:
String selectionMimeType = MediaStore.Files.FileColumns.MIME_TYPE
+ "=?";
String[] selectionArgsPdf = new String[] { MimeTypeMap.getSingleton()
.getMimeTypeFromExtension("mp3"), };
CursorLoader(getActivity(),
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
SONG_SUMMARY_PROJECTION, selectionMimeType,
selectionArgsPdf, MediaStore.Audio.Media.DISPLAY_NAME);
How can I query only mp3 and another file type? thanks.
Upvotes: 0
Views: 244
Reputation: 11
The following edit will do the job
Audio.Media.DATA + " like ? OR " + Audio.Media.DATA + " like ? ";
String[] selectionArgsPdf = new String[]{ "%mp3","%wav" };
CursorLoader(getActivity(), MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
SONG_SUMMARY_PROJECTION, selectionMimeType,
selectionArgsPdf, MediaStore.Audio.Media.DISPLAY_NAME);
Upvotes: 1