Reputation: 23
I am trying to get all albums that are by a particular artist by using the query method. However, i am a beginner and i don't know how to pass a selection argument in the query method.
This is what i have so far:
artistAlbumCursor = getContentResolver().query(
MediaStore.Audio.Artists.Albums.ALBUM, null,
MediaStore.Audio.Media.ARTIST=?, new String[] {artistChosen},
MediaStore.Audio.Artists.Albums.ALBUM + " ASC");
Where artistChosen is the String containing the artist needed.
As I said i don't actually know how to pass a selection argument in so this was just an attempt.
So i guess what I'm asking is, how do i pass a selection argument into the query method.
Any help will be greatly appreciated.
Upvotes: 2
Views: 1398
Reputation: 42016
try with this
artistAlbumCursor = getContentResolver().query(
MediaStore.Audio.Artists.Albums.ALBUM, null,
MediaStore.Audio.Media.ARTIST+ "=?", new String[] {artistChosen},
MediaStore.Audio.Artists.Albums.ALBUM + " ASC");
Upvotes: 1