??????????
?????????androidFragment??Activity????????????????????????????????????????????
????????????????????
????1??????????
?????????????????????????????ù????????÷???????????????????????á??????ú???????????????????????????????????A??????????????д????B?????????????????????ж??????B??????????С??????????????????????????????????????????????????A??B????????????·????????????????????????????A??B???????B?????A?????????????????????????????????????????????????????????????????A?????B??B??????????????A??
????2??????????
????????????????Э???????????????????2?????????????????2???????????′???????????????????????????????????????????????????????????????????????????л?????????????????????ò??????????????????????????????к???顣
????????Java???????
??????C/C++?У??????????????????ú?????????????????????????????Java???????????????????????????????y????????????????????????????????????????????y???????????????????y???????????????????????????????
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????A?????B???????????????????????????????綽???????????????????????綽??
???????????????£?
????1???????????????
????publicinterfaceCallBack
????{
????publicvoiddoEvent();
????}
????2???????????????????????У???????????????????????????????
????publicclassBossimplementsCallBack
????{
????publicvoiddoEvent()
????{
????System.out.println("??綽????壬??????????????");
????}
????}
????3???????????????????е?????????????????????(????????)
publicclassEmployee
{
CallBackcallBack;
publicEmployee(CallBackcallBack)
{
this.callBack=callBack;
}
publicvoiddoWork()
{
System.out.println("?????????....");
callBack.doEvent();
}
}
????4????????
publicclassTestMain
{
publicstaticvoidmain(String[]args)
{
//????????????????????????????????
Employeeemployee=newEmployee(newBoss());
//?????????????????
employee.doWork();
}
}
???????н???????