I have some trouble to build activities with AndroidAnnotations. I have a parent Activity named TemplateActivity:
@EActivity(R.layout.activity_template)
@NoTitle
public class TemplateActivity extends Activity
{
// some views
// ...
@ViewById(R.id.main_framelayout)
FrameLayout mainFrameLayout;
@AfterViews
public void postInit()
{
Log.d("DEBUG", "postInit"); // never called, strange...
}
public void setMainView(int layoutResID)
{
mainFrameLayout.addView(LayoutInflater.from(this).inflate(layoutResID, null));
}
}
And in my second Activity, I want to fill mainFrameLayout with anoter layout xml like that :
@EActivity
public class ChildActivity extends TemplateActivity
{
@Override
public void postInit()
{
super.postInit();
setMainView(R.layout.activity_child_one);
}
}
When I want to startActivity, my ChildActivity is blank and postInit was never called. Can anybody tell me what is wrong? Thanks for advance.
System.out.println("postInit");
. UseLog.d("DEBUG", "postInit");
instead. Do you now see the output in Logcat? Second, issetMainView(int)
a method you created? Can you post its code here? – WhereonAndroidAnnotations
. But, shouldn't postInit() in ChildActivity be annotated with@AfterViews
? – Whereon