开发者

android: how to bind a sub-class to a service

I have a class the extends relativelayout. This class is inflated and added to a view by an activity. This class needs information from a service that I've created. What I'd like to do is bind the class to the service on its own thread but I'm not sure how to do it. When I try and call bindservice in the class I get a "method is not applicable" error. If I run bindService from the calling activity's context it does accept it but I get all sorts of problems from that.

I could simply have the calling activity bind to the service and act as a go-between but that's extra work and I can't开发者_运维技巧 help but think there's a better solution. Plus I would like to be able to imbed this class wherever I want to and it will work as its own entity.

Thanks in advance


You can only bind to a Service from an Activity or other Context -- sorry.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜