1

I met an issue very similar with the following, but it's different.

Howto read updated shared preferences?

I've two applications, A.apk has quite a few sharedPreferences need to be fetched from B.apk. I can totally read it from B without a problem. However, when the preferences of A are changed, and then return to B.apk (onResume). Now the preferences fetched from A are not updated. I've to force close the B.apk and restart it to read the updated preferences.

I've also tried to use finish() while leaving A, however, it's not working. Any suggestion?

3
  • Have you tried using editor.Apply(); instead of editor.Commit(); when updating your preferences? (Where editor is your PreferenceManager) Commented Sep 16, 2012 at 16:23
  • Are you calling getSharedPreferences(...) in the onResume() method of B each time or are you holding the SharedPreferences in B and re-using it?? Commented Sep 16, 2012 at 17:11
  • Hi, Squonk. Yes, I am calling it onResume of B each time. Commented Sep 17, 2012 at 2:03

1 Answer 1

1

You can have a ContentProvider in B.apk, and read/updated preferences in A.apk.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.