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

How to use Handler ?????

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

  1. aryaxt

    aryaxt Member
    Thread Starter
    15

    Jun 1, 2010
    21
    0
    15
    I have a socket running as a service.
    It receive some data , and based on this data i need to update my gui, for example populate a ListView. but it doesn't work.
    How can i use a handler here?
    public void socketGotData(String message)
    Code (Text):
    1. //this method is in my service
    2. //it gets called when i get new messages
    3. {
    4.      MyListViewActivity activity = (MyListViewActivity) this.topActivity;
    5.      activity.updateListViewWithData(message);
    6.      //this function works only if i call it inside the activity
    7. }
     

    Advertisement

Share This Page

Loading...