Enhance activities

Kay-Uwe Janssen edited this page Oct 9, 2016 · 8 revisions

Since AndroidAnnotations 1.0

@EActivity

The @EActivity annotation indicates that an activity will be enhanced by AndroidAnnotations. Its value parameter must be a valid layout id, that will be used as the Content View for the activity.

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 {

}

And without any layout id:

@EActivity
public class MyListActivity extends ListActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

}

Also see how to start an annotated activity.

14/10/2018 The 4.5.1 release is out !

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Extending AndroidAnnotations

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.