为什么不调用我的OnSharedPreferenceChangeListener?

时间:2015-11-18 18:43:37

标签: android sharedpreferences android-preferences

我有一个实现OnSharedPreferenceChangeListener的var express = require('express'); var app = express(); var server = require('http').Server(app); var io = require('socket.io')(server); server.listen(80); app.use(express.static(__dirname)); 类。

Example

但是,当我在托管片段的public class Example implements SharedPreferences.OnSharedPreferenceChangeListener { public Example(Context cont) { this.context = cont; SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(cont); sharedPref.registerOnSharedPreferenceChangeListener(this); } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Log.d("TAG", "A preference has changed >>" + key); } } 中更改首选项时,永远不会调用onSharedPreferenceChanged方法:

SettingsActivity

为什么?

0 个答案:

没有答案