Search code examples
androidpreferenceactivityupdatingstart-activity

Update calling activity after PreferenceScreen close?


I have an activity A from where I invoke a PreferenceAvtivity P via a normal startActivity. The user can update some settings there, and after the P is closed, activity A should update itself to get the new settings.

Now I've read here How to return from preference screen to main activity? that you should not/must not open the preferences via startActivityForResult, but rather implement an OnSharedPreferenceChangeListener in activity A.

My problem here is, the updating task in activity A might be a heavy one, and when activity A listens to PreferenceChanges, it updates whenever something was changed in P.

--> I need A to update only once, this is after P is closed.

How can I do that?


Solution

  • Simple: Read relevant preferences in onResume() of activity A.

    Edit: Great nick btw