我有一个类,我从中调用一个新线程。
public class MainClass{
private void cleardata() {
// do something on a separate thread
new Thread(new Runnable() {
@Override
public void run() {
//Do Something
//After this I would like to notify my MainClass that some thing has been done and pass a value.
}
}
}
private void callbackFunc(int a){
// Do something based on value of a
}
}
我的 MainClass 中有一个函数。但是我如何从我的新线程中调用这个函数,以便接收回调。谢谢。