Java 使用Android注释绑定到现有服务?

Java 使用Android注释绑定到现有服务?,java,android,service,annotations,android-annotations,Java,Android,Service,Annotations,Android Annotations,文档说明如何开始和完成服务。是否有任何方法可以通过android annotation与现有类绑定?当您绑定到服务时,只需使用生成的类: Intent intent = new Intent(this, MyService_.class); // note the underscore bindService(intent, mConnection, Context.BIND_AUTO_CREATE); 或者,您可以使用生成的Intentbuilder: bindService(MyServi

文档说明如何开始和完成服务。是否有任何方法可以通过android annotation与现有类绑定?

当您绑定到
服务时,只需使用生成的类:

Intent intent = new Intent(this, MyService_.class); // note the underscore
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
或者,您可以使用生成的
Intent
builder:

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