In an application I am writing a use the Ringtone
class to alert the user when some events occurs. So far everything is working but from the possibility to use other ringtones than the ones I have already installed in the system.
I placed a file named buzzer.mp3
in the assets
folder and I unsuccessfully try to set it in the following way:
Uri ringtoneUri = Uri.parse("file:///android_asset/buzzer.mp3")
Ringtone ringtone = RingtoneManager.getRingtone(getApplicationContext(),
ringtoneUri);
I used AssetsManager
to check that the file is there and it actually founds it so I cannot really get the reason why I cannot set it. The operation logs the following error:
E/﹕ Failed to open file '/android_asset/buzzer.mp3'. (No such file or directory)