I have a class called CommunicationManager which is responsible for communication with server.
It includes methods login()
and onLoginResponse()
. In case of user login the method login()
has to be called and when the server responds the method onLoginResponse()
is executed.
What I want to do is to bind actions with user interface. In the GUI class I created an instance of CommunicationManager called mCommunicationManager
. From GUI class the login()
method is simply called by the line
mCommunicationManager.login();
What I don't know how to do is binding the method from GUI class to onLoginResponse()
. For example if the GUI class includes the method notifyUser()
which displays the message received from theserver.
I would really appreciate if anyone could show how to bind methods in order to execute the method from GUI class (ex. GUI.notifyUser()
) when the instance of the class mCommunicationManager
receives the message from the server and the method CommunicationManager.onLoginResponse()
is executed.
Thanks!