将MP3文件作为铃声文件、铃声

2023-09-07 12:53:59 作者:久居深巷守一段旧时光

我已经做了你猫一个按钮,听到铃声的应用程序!我如何添加一个选项,将其保存到您的设备作为铃声,如果你喜欢?谢谢

I have made an app that you puss a button and hear a ringtone!How can i add an option to save it to your device as a ringtone,if you like?thanks

推荐答案

的http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

应该存储在SD卡/手机铃声

It should be stored on a sdcard /Ringtones

如果你想保存不属于特定于应用程序,并且不应该被删除,当应用程序被卸载后,将它们保存到外部存储的公共目录中的一个文件。这些目录放置在外部存储的根,如音乐/,图片/,铃声/和其他

If you want to save files that are not specific to your application and that should not be deleted when your application is uninstalled, save them to one of the public directories on the external storage. These directories lay at the root of the external storage, such as Music/, Pictures/, Ringtones/, and others.

在API级别8或更大,使用getExternalStoragePublicDirectory(),传递你想要公开目录,如DIRECTORY_MUSIC,DIRECTORY_PICTURES,DIRECTORY_RINGTONES或其他的类型。如有必要,此方法将创建相应的目录。

In API Level 8 or greater, use getExternalStoragePublicDirectory(), passing it the type of public directory you want, such as DIRECTORY_MUSIC, DIRECTORY_PICTURES, DIRECTORY_RINGTONES, or others. This method will create the appropriate directory if necessary.

我读的地方,你可以把它们放在/媒体/铃声,但这未记录其他地方。所以,你应该用什么,他们在该文档中写道。

I read somewhere that you can put them in /media/ringtones but this isn't documented anywhere else. So you should use what they wrote in the docs.