Search code examples
androidandroid-contentproviderandroid-preferences

Number instead ringtone name


I want to get ringtone name. I use this code

Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue));
String name = ringtone.getTitle(preference.getContext());

And I get number (for example - 17090) not ringtone name. What's wrong?


Solution

  • I had this same problem with recent versions of Android (4.4). There must be an issue with getTitle() and external storage since it works fine on internal storage. I also found that read access will also work. That may be less invasive for users.

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />