For people who are still looking for an answer to this, I'd suggest doing the following:
String[] mProjection =
{
MediaStore.Audio.Artists._ID,
MediaStore.Audio.Artists.ARTIST,
MediaStore.Audio.Artists.NUMBER_OF_TRACKS,
MediaStore.Audio.Artists.NUMBER_OF_ALBUMS
};
Cursor artistCursor = mContentResolver.query(
MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,
mProjection,
null,
null,
MediaStore.Audio.Artists.ARTIST + " ASC");
Now you can query this cursor to get the name of all artists. There won't be any duplicates.
I understand that this is not the solution to "get unique values from MediaStore" in general. But it would solve this very specific problem.
Explanation:
You just have to query the right table, which in this case was the "Artist
" table, while the op was querying the "Media
" table.
Hope this helps someone.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…