获取 Android 中可用铃声的列表
我已经看过很多有关如何设置默认铃声的示例,但我更感兴趣的是能够填充下拉框列表,其中填充了手机上的可用铃声。因此,人们在 Android 设置中更改铃声时看到的列表,我希望能够列出所有这些。
我发现的最接近的东西是这里,但这只是为了设置默认铃声。有人有什么想法吗?它可以位于铃声管理器之内或之外。
I've seen plenty of examples of how to set a default ringtone, but what I'm more interested in is being able populate a drop down box list filled with the available ringtones on the phone. So the list that people see when they change their ringtone in the android settings, I want to be able to list all of those.
The closest thing I've found is here, but again this is just for setting the default ringtone. Any ideas anyone? It can be in or out of ringtonemanager.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这将返回所有可用铃声的标题和 uri。和他们一起做你想做的事!
This will return you the title and uri of all the ringtones available. Do with them what you wish!
RingtoneManager 就是您正在寻找的。您只需使用 setType 来设置 < a href="http://developer.android.com/reference/android/media/RingtoneManager.html#TYPE_RINGTONE" rel="noreferrer">TYPE_RINGTONE ,然后迭代由getCursor。
这是一个假设方法的工作示例,该方法返回 URI 数组,唯一的细微差别是它正在查找闹钟而不是铃声:
RingtoneManager is what you are looking for. You just need to use setType to set TYPE_RINGTONE and then iterate over the Cursor provided by getCursor.
This is a working example of an hypothetical method that returns an array of URIs, with the only slight difference that it's looking for alarms instead of ringtones: