1. Download our Official Android App: Forums for Android!

Apps Accessing and intent from a Service?

Discussion in 'Android Development' started by aryaxt, Jun 11, 2010.

  1. aryaxt

    aryaxt Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    21
    Joined:
    Jun 1, 2010

    Jun 1, 2010
    21
    0
    15
    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.
    Code (Text):
    1. public void socketGotMessage(String message)
    2. {
    3.      if (message == "chat")
    4.      {
    5.             Activity myTopActivity = //somehow get the top activity
    6.             myTopActivity.displayChatMessage("You got a message");
    7.      }
    8. }
     

    Advertisement

Share This Page

Loading...