Skip to content
pyricau edited this page Jan 10, 2012 · 5 revisions

@EActivity

Since AndroidAnnotations 1.0

The @EActivity annotation indicates that an activity is part of AndroidAnnotations. Its value parameter must be a valid layout id, that will be used as the Content View for the activity. The activity must not be final, and can be abstract.

You can leave the value parameter empty, which means that no content view will be set. You will probably want to set the content view yourself in the onCreate() method, before the binding is done.

Usage example:

@EActivity(R.layout.main)
public class MyActivity extends Activity {
[...]

Equivalent boilerplate code:

public class MyActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
[...]

And without any layout id:

@EActivity
public class MyListActivity extends ListActivity {
[...]

Equivalent boilerplate code:

public class MyListActivity extends ListActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
[...]

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally