android call an outside function from a thread

Posted by junmats on Stack Overflow See other posts from Stack Overflow or by junmats
Published on 2010-06-10T06:15:12Z Indexed on 2010/06/10 6:43 UTC
Read the original article Hit count: 322

Filed under:
|
|
|
|

hi.. say for example I have this code in my activity:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);   
    Thread cThread = new Thread(new Runner());
    cThread.start();
}

private NotifyMe(){
    //do something here
}

and this is my Runner class:

public class TCPClient implements Runnable {
   public void run(){
      //call NotifyMe() [THIS IS MY QUESTION]
   }
}

I have a thread on my activity that runs the Runner Class. Once the thread start, I would like to call the NotifyMe() function that is located at the activity. Is this possible? Please let me know if you don't understand my question. Thanks in advance.

© Stack Overflow or respective owner

Related posts about android

Related posts about function