作者darkk6 (Mr. Pan)
看板AndroidDev
标题Re: [问题] Service 与呼叫者的互动
时间Tue Nov 17 00:20:32 2015
感谢大家的指导,终於想通了 Listener 也要宣告 aidl 的意义,
我一直想透过 aidl 把 Caller Pass 给 Service,还去实作 Parcelable..
後来看了十座的范例才想到,只要 pass Listener 就好了:
IServiceBinder.aidl
interface IServiceBinder {
void setListener(MyListener listener);
}
MyListener.aidl
interface MyListener {
void onButtonClick();
}
我之前一直想把 setListener 写在 Service 中,原来应该要写在 Binder 里面..
感谢大家~
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 122.254.16.222
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1447690834.A.757.html