Question

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?

Was it helpful?

Solution

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

Edit: Great nick btw

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top