Reputation: 568
i have such trouble. ContentResolver doesn't see several mp3s on my Meizu MX3. I use it as follows:
ContentResolver mResolver;
...
String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
Cursor cur = mResolver.query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
null,
selection,
null,
null);
if (!cur.moveToFirst()) {
Log.e(TAG, "Failed to move cursor to first row (no query results).");
return;
}
After that cursor doesn't contains all the music on my phone. For example, it dosn't see my records from the dictophone, although they have mp3 format. There is no file .nomedia in records's directory /sdcard/Recorder. And if I place some mp3 in this dir and scan for media changes ContentResolver will find this mp3, but only this, so records leave invisible for it.
Could anybody explain me why ContentResolver's behaviour is so strange?
Upvotes: 0
Views: 494
Reputation: 127
boruno!
I had simular problem and I think I finally find the solution.
I used the cursor in my app and tried to set datasources to MediaMetaRetriever like this:
mmr.setDataSource(path);
So, when the cursor can't set data source, it trows an exeption:
E/cursor: setDataSource failed: status = 0xFFFFFFEA
After that, the cursor stops itself.
I've just used try-catch blocks and get all music files.
Hope it helps.
Upvotes: 1