铃声preference不节能的选择 [英] Ringtone Preference not saving choice

查看:129
本文介绍了铃声preference不节能的选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个铃声preference在我的应用程序,但是当我选择我需要的音色,它不会存储在preference值。我可以再次点击preference,它不会显示什么,我只是选择了。

下面是XML

 < XML版本=1.0编码=UTF-8&GT?;
< preferenceScreen
的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
< preferenceCategory机器人:标题=音频设置>
        <复选框preference
            机器人:关键=SMS_ preF_TTS
            机器人:标题=发件人说名
            机器人:总结=当一个人在您的联系人列表向您发送SMS / MMS消息,其称他们的名字
            安卓:设置defaultValue =假>
        < /复选框preference>
        <复选框preference
            机器人:关键=SMS_ preF_TTS_MSG
            机器人:标题=消息说
            机器人:总结=会说发件人从联系人列表中的信息
            机器人:依赖=SMS_ preF_TTS
            安卓:设置defaultValue =假>
        < /复选框preference>
        <铃声preference
            机器人:关键=SMS_ preF_SOUND
            机器人:标题=更改声音
            机器人:ringtoneType =通知
            机器人:总结=选择通知声音
            机器人:dialogTitle =更改声音
            安卓:设置defaultValue =静音>
        < /铃声preference>
< / preferenceCategory>
< / preferenceScreen>
 

和奇怪的是我刚写了另一个XML我的应用程序的另一部分与铃声preference寻找相同的方式,一个作品,所以我不明白。

这里是工作一个

 <铃声preference
        机器人:关键=CAL_ preF_TONE
        机器人:标题=默认铃声
        机器人:总结=选择默认的通知铃声
        机器人:ringtoneType =通知
        安卓:设置defaultValue =静音
        机器人:依赖=CAL_ preF_ON>
    < /铃声preference>
 

解决方案

我最终通过注册手动保存它在preferenceClickListener 和获得的结果

I have a ringtone preference in my app but when I select the tone I want, it does not get stored in the preference value. I can click the preference again and it will not show what I just selected.

here is the XML

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Audio Settings">
        <CheckBoxPreference 
            android:key="SMS_PREF_TTS"
            android:title="Say name of sender"
            android:summary="When a person in your contact list sends you a sms/mms message its says their name"
            android:defaultValue="false">
        </CheckBoxPreference>
        <CheckBoxPreference 
            android:key="SMS_PREF_TTS_MSG"
            android:title="Say Message"
            android:summary="Will say the message of sender from contact list"
            android:dependency="SMS_PREF_TTS"
            android:defaultValue="false">
        </CheckBoxPreference>
        <RingtonePreference 
            android:key="SMS_PREF_SOUND"
            android:title="Change Sound"
            android:ringtoneType="notification"
            android:summary="Select the notification Sound"
            android:dialogTitle="Change Sound"
            android:defaultValue="Silent">
        </RingtonePreference>
</PreferenceCategory>
</PreferenceScreen>

and the weird thing is I just wrote another xml for another part of my app with a ringtone preference looking the same way and that one works so I dont understand.

here is the working one

<RingtonePreference
        android:key="CAL_PREF_TONE"
        android:title="Default ringtone"
        android:summary="Select default notification ringtone"
        android:ringtoneType="notification"
        android:defaultValue="Silent"
        android:dependency="CAL_PREF_ON">
    </RingtonePreference>

解决方案

I ended up saving it manually by registering a onPreferenceClickListener and getting the result

这篇关于铃声preference不节能的选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆