开发者

Best approach to be notified when a preference value has been reached

开发者 https://www.devze.com 2023-03-27 19:59 出处:网络
I have a perference(EditTextPreference) that contains a value(integer), i want to trigger a notification when the value of this preference has been reached. What is the best approach to use? Service o

I have a perference(EditTextPreference) that contains a value(integer), i want to trigger a notification when the value of this preference has been reached. What is the best approach to use? Service or Alarm? And can you please provide me some examples. I never used such structures. An error on the point between km.onPreferenceChange

Syntax 开发者_C百科error on token ".", ; expected

settings.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

                public boolean km.onPreferenceChange(Preference preference,
                        Object newValue) {


Add a Preference.OnPreferenceChangeListener to your EditTextPreference and simply check if the new value exceeds your limit value.

0

精彩评论

暂无评论...
验证码 换一张
取 消