1. Check out our companion app, Forums for Android! Download from Google Play

Accessing and intent from a Service?

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

  1. aryaxt

    aryaxt Member
    Thread Starter
    15

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