callback接口
public interface CallBack {
public String testCallBack(String a);
}
处理类
public class TestCallBack {
/**
*
* @param callBack
* @param data
*
* @return
*/
public String executeMessage(CallBack callBack, String data) {
//一系列处理
return callBack.testCallBack(result);
}
}
回调使用
TestCallBack c = new TestCallBack();
String cc = c.executeMessage(new CallBack() {
@Override
public String testCallBack(String a) {
// TODO Auto-generated method stub
return a + "mm";
}
}, "lalala");