w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Android Playlists Content not found

If I am correct, the intent to get playlist details works, you get the _ids but you do not get the songs. Remember that the _id is the id of the line of each playlist item, NOT the audio_id. I struggled with this for a while. Perhaps this was your issue. This is how I resolved it:

public Cursor getPlaylistTracks(Context context, Long
playlist_id) {
    Uri newuri = MediaStore.Audio.Playlists.Members.getContentUri(
            "external", playlist_id);
    ContentResolver resolver = context.getContentResolver();
    String _id = MediaStore.Audio.Playlists.Members._ID;
    String audio_id = MediaStore.Audio.Playlists.Members.AUDIO_ID;
    String artist = MediaStore.Audio.Playlists.Members.ARTIST;
    String album = MediaStore.Audio.Playlists.Members.ALBUM;
    String album_id = MediaStore.Audio.Playlists.Members.ALBUM_ID;
    String title = MediaStore.Audio.Playlists.Members.TITLE;
    String duration = MediaStore.Audio.Playlists.Members.DURATION;
    String location = MediaStore.Audio.Playlists.Members.DATA;
    String composer = MediaStore.Audio.Playlists.Members.COMPOSER;
    String playorder = MediaStore.Audio.Playlists.Members.PLAY_ORDER;
    String date_modified =
MediaStore.Audio.Playlists.Members.DATE_MODIFIED;
    String[] columns = { _id, audio_id, artist, album_id,album, title,
duration,
            location, date_modified, playorder, composer };
    Cursor cursor = resolver.query(newuri, columns, null, null, null);
    return cursor;
}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.