简体   繁体   English

使用Android Annotations绑定到现有服务?

[英]Bind to existing service with Android Annotations?

Docs enter link description here say how to start and finish service. 文档在此处输入链接说明,说明如何开始和完成服务。 Is there any way to bind with existing one with android annotation? 有没有办法用现有的Android注释绑定?

When you bind to your Service , simply use the generated class: 绑定到Service ,只需使用生成的类:

Intent intent = new Intent(this, MyService_.class); // note the underscore
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);

Or you can use the generated Intent builder: 或者您可以使用生成的Intent构建器:

bindService(MyService_.intent(this).get(), mConnection, Context.BIND_AUTO_CREATE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM