views:

134

answers:

1

Hi,

I have an Android Service. When a phone boots up, a broadcast receiver receives a notification and it schedules the service to run repeatedly at a gap of X minutes. Henceforth After every X minutes another broadcast receiver gets those notifications and kicks the service off, which does it's job and quits. So far so good.

Now I want those X minutes to be configurable. I have a perf.xml similar to what is given at the link below. This XML captures all my preferences along with that of service timer. http://android-journey.blogspot.com/2010/01/for-almost-any-application-we-need-to.html

Now when user changes preferences; how can I reschedule the alarm? Is there a way I can set a listener on preferences change? I have used only XML files to speficy preferences screen.

Any ideas will be welcome.

Cheers

+2  A: 

There is OnPreferenceChangeListener just set it and implement it. As i remember you set it to the preference. So you need to get this preference findPreference("myAlarmInterval"); and then set the listener

Alex Volovoy