Re: Acivities and Places - passing by reference
Hi, If you want activities to be talking to each other, one way of achieving them is via encapsulating the data in the Place, as mentioned above.
Imagine a complex application, where in a lot of objects are required by different activities. In events like that, you have to pass on all the required objects through Place(s). Which is kind of chain, where sometimes, some values have to be passed just to enable the construction of all the possible places/activities that could be triggered from there.
A simple solution on that case could be to have a singleton value store, and use it for value types.
@Singleton
public class ValueStore {
private Map<String, Object> values = new HashMap<String, Object>();
public Object getValue(String key) {
return values.get(key);
}
public void putValue(String key, Object value) {
values.put(key, value);
}
public boolean hasValue(String key) {
return values.containsKey(key);
}
}
Such that the data populated in one activity could be consumed by a host of other related activities.
Just another way of achieving the same!
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/zgVYtJid77AJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home