1

有一个 MainService ,它有一个数据成员 binder ,以及一个返回 binder 的函数成员 onBind() 。
在 Mainactivity 中,它也有一个成员 binder,并且有一个成员 conn,其类是 ServiceConnection,我重写了 onServiceConnected() 函数以将值分配给 binder。我像这样绑定服务:bindservice(intent, conn, Service.BIND_AUTO_CREATE) ,我在 onCreate() 中发布了这个函数。但是,结果是 binder 为 null。

4

0 回答 0