Wednesday, April 25, 2012

Re: Activity how to react on event that is triggered in start-method

Instead of using the EventBus you could also use a Callback in your StateResolver. Seems to me that only the class that calls stateResolver.resolve() is interested in the result, so there isn't a real need for using an application wide event bus.

stateResolver.resolveState(...., new Callback() {
  void onSuccess() {
    //call method that handles the state
   }
});

Or you implement the Callback interface directly in your Activity (but then I would rename it to StateResolverPeer.stateResolved(T state) or something like that) and then simply call stateResolver.resolveState(...., this).

If there is a 1:1 relation I would not use event bus in most cases.

-- J.

--
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/-/ePWPCIIcKSMJ.
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.

No comments:

Post a Comment