如果你把data/data/
sd卡下的db檔案拉出來看過,你會知道,其實設定鈴聲很簡單,只需要更新android掃描出來的音樂檔案的欄位即可
switch (R_id) {case R.id.set_alarms:values.put(MediaStore.Audio.Media.IS_ALARM, true); mContext.getContentResolver().update(uri, values, "_id=?", new String[]{Uri_id+""});RingtoneManager.setActualDefaultRingtoneUri(mContext, RingtoneManager.TYPE_ALARM, new_uri); case R.id.set_notifications:values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true); mContext.getContentResolver().update(uri, values, "_id=?", new String[]{Uri_id+""});RingtoneManager.setActualDefaultRingtoneUri(mContext, RingtoneManager.TYPE_NOTIFICATION, new_uri);break;case R.id.set_ringtones:values.put(MediaStore.Audio.Media.IS_RINGTONE, true); mContext.getContentResolver().update(uri, values, "_id=?", new String[]{Uri_id+""});RingtoneManager.setActualDefaultRingtoneUri(mContext, RingtoneManager.TYPE_RINGTONE, new_uri);break;
}