android - How to use different layoutRes with Butterknife for BaseActivityClass and ActivityExtending it? -


i want use butterknife having keep drawer logic being created , maintined in baseactivityclass extended of other activities having different layoutids.

tried providing layoutid via abstract method , inflating manually, butterknife failes error:

caused by: java.lang.illegalstateexception: required view 'view' id 2131493000 field 'mview' not found. if view optional add '@nullable' annotation. 

base class

 @bind(r.id.leftdrawer) protected listview mleftdrawer;  @bind(r.id.drawerlayout) protected drawerlayout mdrawerlayout;  @bind(r.id.contentframe) protected framelayout mcontentframe;  private actionbardrawertoggle drawertoggle;  protected abstract @layoutres int getcontentlayout();  private intents mintents;  private string[] moptionstitles = new string[]{         "menu item 1",         "menu item 2",         "menu item 3" };  @override protected void oncreate(@nullable bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.drawer_activity);     getlayoutinflater().inflate(getcontentlayout(), mcontentframe);     butterknife.bind(this); } 

activity class

@override protected int getcontentlayout() {     return r.layout.activity_main; } 

at moment left options drop butterknife, or duplicate logic drawer handling in activities. both options prefer avoid.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -