preferenceChangeListener

preferenceChangeListener

本文介绍了铃声preference不费一枪在preferenceChangeListener的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每隔preference我有触发其在preferenceChangeListener。然而,我的铃声preference它不会:

  P =获取preferenceScreen()找到preference(pref_tone);
串RNAME = preferences.getString(pref_tone,Settings.System.DEFAULT_RINGTONE_URI.toString());
字符串名称= ringtoneToName(RNAME);
p.setSummary(名称);
p.setOn preferenceChangeListener(新在preferenceChangeListener(){
在preferenceChange公共布尔(preference preference,对象为newValue){
    //永远不要打了!
    串V =(字符串类型)newValue;
    preference.setSummary(ringtoneToName(ⅴ));
    返回true;
}
});
 

解决方案

onActivityResult只好打电话super.onActivityResult是修复

Every other preference I have fires its OnPreferenceChangeListener. However, my RingtonePreference it doesn't:

p = getPreferenceScreen().findPreference("pref_tone");
String rname = preferences.getString("pref_tone",Settings.System.DEFAULT_RINGTONE_URI.toString());
String name = ringtoneToName(rname);
p.setSummary(name);
p.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
    // Never hits here!
    String v = (String) newValue;
    preference.setSummary(ringtoneToName(v));
    return true;
}
});
解决方案

onActivityResult had to call super.onActivityResult is the fix

这篇关于铃声preference不费一枪在preferenceChangeListener的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 11:16