通过code创建播放列表 [英] Creating Playlist via code

查看:118
本文介绍了通过code创建播放列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关我的最新项目我希望用户能够使播放列表,并将其保存到手机上。我想要所以当他们使他们在应用程序中,他们也将显示出来,当他们在内置的音乐应用程序的样子。请告诉我这样做的最佳方式?我知道我可能会不得不使用MediaStore但除此之外,我失去了一点点。任何信息会有所帮助,只需要在正确的方向轻推 - 谢谢

For my latest project i want the user to be able to make playlist and save them to the phone. I want to make so when they make them in the application they will also show up when they look in the built in music app. Whats the best way of doing this? I know i will probably have to use MediaStore but other than that I'm a tad lost. Any information would help, just need a nudge in the right direction - Thanks

推荐答案

您可以使用URI发现在内容的 Media.AudioStore.Playlist 类来访问播放列表内容提供商。通过插入元素融入到播放列表内容提供商,你就可以在音乐应用程序插入的播放列表。

You can use the content URI found in Media.AudioStore.Playlist class to access the playlist content provider. By inserting elements into the Playlist content provider you'll be able to the inserted playlists in the Music application.

举例code:

 ContentResolver contentResolver = Context.getContentResolver();
 //Get all the playlists
 Cursor playlist = contentResolver.query(
   Media.AudioStore.Playlist.getContentUri(Media.AudioStore.Playlist.EXTERNAL_CONTENT_URI));

您可以玩的类的更多获取如何使用他们一个更好的主意。注意内部类Media.AudioStore.Playlist了,<一个href=\"http://developer.android.com/reference/android/provider/MediaStore.Audio.Playlists.Members.html\"相对=nofollow> Media.AudioStore.Playlist.Memebers 的。

You can play around with the classes more to get a better idea of how to use them. Note the inner class that Media.AudioStore.Playlist has, Media.AudioStore.Playlist.Memebers.

这篇关于通过code创建播放列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆