org.androidannotations.annotations
Annotation Type ServiceAction


@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)
                                .myAction("test", 10L)
                                .start();
        }
 
 }
 
 @EIntentService
 public class MyIntentService extends IntentService {
 
        @ServiceAction
        void mySimpleAction() {
                // ...
        }
 
        @ServiceAction
        void myAction(String valueString, long valueLong) {
                // ...
        }
 }
 

See Also:
EIntentService

Optional Element Summary
 String value
          Define the action's name.
 

value

public abstract String value
Define the action's name. If this field isn't set the annotated method name will be used.

Default:
""


Copyright © 2010-2014. All Rights Reserved.