org.androidannotations.annotations
Annotation Type EIntentService


@Retention(value=CLASS)
@Target(value=TYPE)
public @interface EIntentService

Should be used on IntentService 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 intentservice 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 activity with a fluent API. Android's extra can also be enhanced by using Extra annotation on every native or serializable/parcelable field.

The IntentService class should contain a ServiceAction annotated method in order to respond to an action.

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:
AfterInject, ServiceAction



Copyright © 2010-2014. All Rights Reserved.