我尝试了以下代码,但它设置了默认铃声。
Uri path = Uri.parse("android.resource://com.mypackagename/"+R.raw.sound);
RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_RINGTONE, path);
答案 0 :(得分:0)
final String packageName = context.getPackageName();
Uri.parse("android.resource://" + packageName + "/"+R.raw.xxx);