Issue
I have an activity that contains a WordPress article. The text size of the article can be modified in the settings. Loading a new article will now show the modified text size. However, this change does not affect article activities in the backstack, which still show the old text size.
What's the best way to handle this scenario?
I tried an OnSharedPreferenceChangeListener
, but I don't think the backstack activity was able to receive the change event because it was in the backstack. I am now thinking of persisting the time the preference was changed and comparing it to when the original article activity was instantiated in the onResume
, then reload the article accordingly.
Is there a better way to do this?
Solution
You could persist the actual value instead of a time, but other than that: no.
A paused activity shouldn't do anything, even if it would be possible somehow.
onResume
is the way to go here.
Further Explanation: An Activity that is paused could theoretically still be used by other references, but a paused Activity might be unloaded at any time when Android runs low on RAM. It is then restored from a savedInstanceState when you return to it. So, using a paused Activity is unreliable, because it might or might not be unloaded.
Answered By - F43nd1r
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.