本文介绍了在我的Android原文件夹设置铃声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想读/在我的原始文件夹来访问一个mp3文件,然后将其设置为默认铃声。但它不是能够找到它。
I am trying to read/access an mp3 file in my Raw folder and then set it as default ringtone. But it is not able to find it.
我的code是 -
My code is -
Uri path = Uri.parse("android.resource://com.applenty/LearnToCount/raw/mysoundfile");
RingtoneManager.setActualDefaultRingtoneUri(
getApplicationContext(), RingtoneManager.TYPE_RINGTONE,
path);
Log .i("TESTT", "Ringtone Set to Resource: "+ path.toString());
RingtoneManager.getRingtone(getApplicationContext(), path)
.play();
啥子是错误的吗?我曾尝试过各种组合此处
Waht is wrong in here? I have tried all sort of combination here
推荐答案
这是为我工作。 (删除LearnToCount)
This is working for me. (remove LearnToCount)
Uri path = Uri.parse("android.resource://com.applenty/raw/mysoundfile");
然后在你的清单。
And then in your manifest.
<uses-permission android:name="android.permission.WRITE_SETTINGS"></uses-permission>
这篇关于在我的Android原文件夹设置铃声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!