什么方法时,preferenceActivity保存的值被称为 [英] What method is called when PreferenceActivity saves values
问题描述
我有一个应用程序,它使用preferenceActivity定义的时间段来运行计划任务。 但我不能正确的方法来覆盖preferenceActivity进行重组的周期值的任务变了。
有谁知道什么方法时,preferenceActivity保存值被称为? 我使用的API 8级似乎的onSaveInstanceState(包outState)是不是我找的。 P>
没有回调改变了preferences在preferenceActivity。但是,你可以使用正常的<一个href="http://developer.android.com/reference/android/content/Shared$p$pferences.OnShared$p$pferenceChangeListener.html"相对=nofollow> OnShared preferenceChangeListener ,你会用在其他地方。只要注册它,你就会得到通知时,一个preference变化。检查在回调正确的密钥,并重新安排你的任务。
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.
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.
这篇关于什么方法时,preferenceActivity保存的值被称为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!