I'd like to get the list of songs of an album by querying the MediaStore
with CursorLoader
How can i do this ? I can get all the songs of the device with this code :
static final String[] TRACK_SUMMARY_PROJECTION = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.TITLE};
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String sortOrder = MediaStore.Audio.Media.TITLE + " ASC";
String select = null;
return new CursorLoader(getActivity(), MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
TRACK_SUMMARY_PROJECTION, select, null,
sortOrder);
}
What should I add to the code or modification to filter songs of a particular Album ?
Go step by step
Step 1 Look the names of albums loaded on you phone
To request cursor for Album information
Step 2 Once you find all album names.You can write down the desired album name and query songs from it
To request cursor containing song information for particular album
Now return this cursor.
For your reference below is Source code to retrieve Album name and all songs in it.