@Retention(value=CLASS) @Target(value=METHOD) public @interface ServiceAction
Should be used on a method that must respond to a specific action in an
EIntentService annotated class. The method name will be used as
action name unless the value() field is set.
The method signature (ie with attributes) will be a part of the IntentBuilder
generated for the EIntentService.
The method could contain any type or parameters.
The class MAY contain several ServiceAction annotated methods.
Example :
@EActivity(R.layout.main)
public class MyActivity extends Activity {
public void launchAction() {
// Note the use of generated class instead of original one
MyIntentService_.intent(this)
.<b>myAction</b>("test", 10L)
.start();
}
}
@EIntentService
public class MyIntentService extends IntentService {
@ServiceAction
void mySimpleAction() {
// ...
}
@ServiceAction
void <b>myAction</b>(String valueString, long valueLong) {
// ...
}
@Override
protected void onHandleIntent(Intent intent) {
// empty, will be overridden in generated subclass
}
}
Note: Since
IntentService#onHandleIntent is abstract, you have to add an empty
implementation. For convenience, we provide the
AbstractIntentService class, which implements that method, so you do not
have to do in your actual class if you derive it.
EIntentService,
AbstractIntentServicepublic abstract String value
Copyright © 2010-2015. All Rights Reserved.