如果你把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;
}