开发者

Get the Ringtone title from RingtonePreference

I have a RingtonePreference that is used to select a ringtone that is broadcasted to a receiver used in an Alarm application.

I would like to display the title (the titles displayed in the list you see when you choose the ringtone) of the selected ringtone in the summary of the RingtonePrefernce. Somehow get the ID3 tag? Some ringtones would be mp3 but not all so this might not be a good idea?

What I do now is:

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
strRingtonePreferen开发者_运维问答ce = prefs.getString("RingtonePref", "DEFAULT_RINGTONE_URI");

This will make strRingtonePreference look like "content://media/internal/audio/media/55" which is not very informative to the user.

How can I do this?


Uri ringtoneUri = Uri.parse(strRingtonePreference);
Ringtone ringtone = RingtoneManager.getRingtone(context, ringtoneUri);
String name = ringtone.getTitle(context);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜