In Android, I have two Apps sharing user ID. App A creates a sharedPreference and App B can read it in its activity's onResume(). The question is: I modified the preference in A and then go to B, I find the value is still the old one -- I am sure the preference has committed because I can see the new value in Pref.xml. I have to exit B and re-enter it, then I can see the new value. Would you please point me why? where is the buffer? how to refresh the preference mandatory? Thanks for your comments in advance :)
Asked
Active
Viewed 52 times
0
-
Take a look at [this](http://stackoverflow.com/a/6030399/6950238) answer. – Andrii Omelchenko Nov 14 '16 at 09:32
-
are you sure to re-load shared prefs in App B after modified in app A? – Vladyslav Matviienko Nov 14 '16 at 09:46
-
@Vlad Matvienko How does one reload them? – greenapps Nov 14 '16 at 10:17
-
init them again - `prefs = getSharedPreferences(...)` – Vladyslav Matviienko Nov 14 '16 at 11:01
-
Actually, I do prefs = getSharedPreferences(...) in onResume, but it still retrieve the old value although the value has been changed by App A. – Marco Nov 15 '16 at 01:41