我一直试图使用SoundPool播放默认铃声,但没有成功。在下面的代码中:
String ringtone = Settings.System.DEFAULT_RINGTONE_URI.getPath();
SoundPool ringPhone = new SoundPool(2, AudioManager.STREAM_RING, 1);
int soundID = ringPhone.load(Settings.System.DEFAULT_RINGTONE_URI.getPath(), 1);
int soundID = ringPhone.load(ringtone, 1);
ringPhone.play(soundID, 0.99f, 0.99f, 1, 0, 1);
我收到了“error loading content /system/ringtone sample 0 not READY”的错误消息。将URI替换为SD卡上现有mp3文件的硬路径会产生类似的结果。
我做错了什么?谢谢,
kyle