What method is called when PreferenceActivity saves values

自作多情 提交于 2019-12-12 01:39:12

问题


I have an app which uses PreferenceActivity to define time period to run scheduled tasks. But I can't the right method to Override in PreferenceActivity to make tasks rescheduled on period values changed.

Does anyone know what method is called when PreferenceActivity saves values? I am using API 8 level and seems that onSaveInstanceState(Bundle outState) is not that I am looking for.


回答1:


There is no callback for changed preferences in a PreferenceActivity. But you can use the normal OnSharedPreferenceChangeListener that you would use everywhere else. Just register it in and you'll get notified when a preference changes. Check for the correct key in the callback and reschedule your tasks.



来源:https://stackoverflow.com/questions/6962942/what-method-is-called-when-preferenceactivity-saves-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!