This situation is bit similar to the reason why I implemented the
activate/deactivate feature (
http://groups.google.com/group/mvp4g/
browse_thread/thread/76e36c0cbc59d3ec/c2211f3944c9f6a9). Basically I
wanted only one presenter to receive the response so I would
deactivate the other ones. In my case, only one presenter was
displayed at a time so when the presenter's view was hidden, I
deactivated the presenter.
The activate/deactivate feature may not work as well if you have
several presenters displayed. Also a drawback with this feature is
that the configuration can become complicated.
For this kind of issue, I now tend to use the callback solution
suggested by Mohit in the other post.
You can then have a callback event class like this:
public interface EventCallback<T> {
void reply(T replyInfo);
}
and with your event, you pass a callback object:
void requestPrice(EventCallback<Integer> callback);
then the presenter that handles it use it to call back the sender:
public void onRequestPrice(EventCallback<Integer> callback){
int price = ....
callback.reply(price);
}
What do you think of this solution?
Pierre