@Retention(value=CLASS) @Target(value=TYPE) public @interface EService
Should be used on Service classes to enable usage of
AndroidAnnotations.
Your code related to injected beans should go in an AfterInject
annotated method.
If the class is abstract, the enhanced service will not be generated. Otherwise, it will be generated as a final class. You can use AndroidAnnotations to create Abstract classes that handle common code.
The generated class will also contain an IntentBuilder to start service with a fluent API.
Example :
@EActivity(R.layout.main)
public class MyActivity extends Activity {
public void startService() {
// Note the use of generated class instead of original one
MyService_.intent(this).start();
}
public void stopService() {
// Note the use of generated class instead of original one
MyService_.intent(this).stop();
}
}
@EService
public class MyService extends Service {
}
AfterInject,
ServiceActionCopyright © 2010-2015. All Rights Reserved.