I have a service running in the background. (A socket class)
When the socket receives message i need to access the Activity that is shown on the screen and update the gui, any idea how i can manage to get the Activity shown to the user?
Thanks.
When the socket receives message i need to access the Activity that is shown on the screen and update the gui, any idea how i can manage to get the Activity shown to the user?
Thanks.
Code:
public void socketGotMessage(String message)
{
if (message == "chat")
{
Activity myTopActivity = //somehow get the top activity
myTopActivity.displayChatMessage("You got a message");
}
}