I do something kinda similar. I make the assumption that a Place
object should store all the state/data for the particular place. I
then have something called a ContextWatcher which controls any
application wide state or data. I use a static Cache class to actually
store any data.
The impl also makes it very easy to rebuild application state from a
refresh or bookmark
Everything is controlled by a PlaceChangeEvent. So, on a PCE the new
Activity (ActivityMapper calles setPlace(NewPlace) - which makes the
start() method somewhat irrelevant but allows the same place to be
called consecutively and have new params for each place) and
ContextWatcher (implements PCE.Handler) so both have a reference to
the new Place. The Activity adds an a callback to the place
(addOnValidCallback - other objects which need to know when the Place
and AppWide info is valid) and the ContextWatcher adds a callback to
the place for onContextCheck (basically the place will make sure it
has the necessary data it needs then hands control over to the
ContextWatcher. The ContextWatcher does its thing and then calls
place.startOnValidCallbacks. The place will then go through all
callbacks that need to know everything is valid (The activity and any
other object that have been put on hold)
The method has been working extremely well for keeping Application
State, Place specific data, Refresh, Bookmark, Caching etc
It does add some custom complexity to the mix and slightly changes the
way an activity is started but has proved well worth it.
on a PCE the place will take the String token given to its constructor
and then check to make sure the Client Cache has all the necessary
data (retrieving it when needed).