Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AndroidAnnotations how to add init code after onCreate

If I have an activity defined as:

@EActivity(R.layout.activity_login)
public class LoginActivity extends Activity

This will create the onCreate() method for me, but I have extra init code that I want to go after the onCreate method, how should I do this? I could create my own onCreate method and use an empty @EActivity, but is there a better way?

like image 238
Rocky Pulley Avatar asked May 23 '13 15:05

Rocky Pulley


1 Answers

Use the @AfterViews annotation to define your own initialization code:

@AfterViews
protected void init() {
    // your custom code
}
like image 196
Mifeet Avatar answered Oct 17 '22 15:10

Mifeet