通过了解歌曲的标题,您可以恢复存储在RingtonePreference中的铃声URI的方式(据我所知).然后你可以通过使用游标来获取存储的铃声_id来查询它,你可以用它构建一个URI:
String ringtoneTitle = "";
Uri parcialUri = Uri.parse("content://media/external/audio/media"); // also can be "content://media/internal/audio/media", depends on your needs
Uri finalSuccessfulUri;
RingtoneManager rm = new RingtoneManager(getApplicationContext());
Cursor cursor = rm.getCursor();
cursor.moveToFirst();
while(!cursor.isAfterLast()) {
if(ringtoneTitle.compareToIgnoreCase(cursor.getString(cursor.getColumnIndex(MediaStore.MediaColumns.TITLE))) == 0) {
int ringtoneID = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
finalSuccessfulUri = Uri.withAppendedPath(parcialUri, "" + ringtoneID );
break;
}
cursor.moveToNext();
}
其中finalSuccessful uri是uri指向RingtonePreference中的铃声.