org.androidannotations.annotations
Annotation Type EActivity


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

Should be used on Activity classes to enable usage of AndroidAnnotations.

Your code related to injected beans should go in an AfterInject annotated method.

Any view related code should happen in an AfterViews annotated method.

If the class is abstract, the enhanced activity 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 annotation value should be one of R.layout.* fields. If not set, no content view will be set, and you should call the setContentView() method yourself, in onCreate()

Example :
 @EActivity(R.layout.main)
 public class MyActivity extends Activity {
 
        public void launchActivity() {
                // Note the use of generated class instead of original one
                MyActivityTwo_.intent(this).startActivity();
        }
 }
 
 @EActivity(R.layout.main)
 public class MyActivityTwo extends Activity {
 
        @Bean
        MyBean myBean;
 
        @ViewById
        TextView myTextView;
 
        @AfterInject
        void init() {
                myBean.doSomeStuff();
        }
 
        @AfterViews
        void initViews() {
                myTextView.setText("test");
        }
 }
 

See Also:
AfterInject, AfterViews, Extra

Optional Element Summary
 String resName
           
 int value
           
 

value

public abstract int value
Default:
-1

resName

public abstract String resName
Default:
""


Copyright © 2010-2014. All Rights Reserved.