AndroidAnnotations how to add init code after onCreate

你离开我真会死。 提交于 2019-12-07 02:54:53

问题


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?


回答1:


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

@AfterViews
protected void init() {
    // your custom code
}


来源:https://stackoverflow.com/questions/16718266/androidannotations-how-to-add-init-code-after-oncreate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!