java - Callback from new thread to class from which thread was initiated -
i have class calling new thread.
public class mainclass{ private void cleardata() { // on separate thread new thread(new runnable() { @override public void run() { //do //after notify mainclass thing has been done , pass value. } } } private void callbackfunc(int a){ // based on value of } }
i have function in mainclass. how call function new thread, receive callback. thanks.
you should able call method in mainclass
name if calling directly inside mainclass
(as opposed inner class).
if method name want call happens conflict 1 inner class has inherited object
can prefix call mainclass.this
, e.g. mainclass.this.tostring()
calls tostring
on mainclass
, whereas tostring()
calls on inner class instance.
Comments
Post a Comment