android - Why do defaultsharedpreferences get but saved when I exit my app? -


i have simple activity consisting of main activity, second activity , preferenceactivity.

what do:

  1. i run app, mainactivity triggers oncreate
  2. oncreate fetches sharedpreferences , prints value console
  3. i go settings, change value of amount , press back.
  4. oncreate triggers again , logs newly set value (good)
  5. the oncreate triggers repeating alarm. in receiver class log sharedpreferences.
  6. the problem: value logged in receiving class still old value!
  7. next close app. alarm keeps running (as should) , receiver starts logging new, correct value.

so, change preference value picked in main activity other classes requires app exit / restart pickup change.

i've been reading google documentation preferences, followed tutorials, ... been struggling 3 evenings.

advice appreciated.

edit: found problem, had in manifest

<receiver android:name="alarm" android:process=":remote" /> 

because on process preference changes not detected

found post: https://stackoverflow.com/a/10770175/1323883


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -