在RingtonePreference中加载外部mp3文件

时间:2017-12-27 09:57:12

标签: android

创建铃声首选项,但它会显示所有手机铃声供用户选择。我想让用户可以从他的存储中选择一个特定的mp3文件作为铃声。

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

<!-- A 'parent' preference, which enables/disables child preferences (below)
     when checked/unchecked. -->
<SwitchPreference
    android:defaultValue="true"
    android:key="notifications_new_message"
    android:title="@string/pref_title_new_message_notifications" />

<!-- Allows the user to choose a ringtone in the 'notification' category. -->
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
<!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
<RingtonePreference
    android:defaultValue="content://settings/system/notification_sound"
    android:key="notifications_new_message_ringtone"
    android:ringtoneType="all"
    android:title="@string/pref_title_ringtone" />

<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
<SwitchPreference
    android:defaultValue="true"
    android:dependency="notifications_new_message"
    android:key="notifications_new_message_vibrate"
    android:title="@string/pref_title_vibrate" />

0 个答案:

没有答案