Android Create Playlist

后端 未结 4 1525
暗喜
暗喜 2020-12-23 10:58

Anyone know how to add playlists to Android in code?

I kind of get that I have to insert it into the content resolver but do I have to just put the song id in or do

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-23 11:24

    This is corrected code which remove song from Playlist:

    public static void removeFromPlaylist(ContentResolver resolver, int audioId) 
    {
    Uri uri = MediaStore.Audio.Playlists.Members.getContentUri("external", YOUR_PLAYLIST_ID);
    resolver.delete(uri, MediaStore.Audio.Playlists.Members._ID +" = "+audioId, null);
    }
    

提交回复
热议问题