I already read Some problems on github , but still have not found a solution.
My problem is that I cannot bind views to a child action inherited from BaseActivty
Code in my BaseActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewGroup rootView = (ViewGroup) this.findViewById(android.R.id.content);
View rootBaseView = getLayoutInflater().inflate(R.layout.activity_base, rootView, false);
ButterKnife.bind(this, rootBaseView);
....
int childLayoutID = getLayoutResId();
if (childLayoutID != LayoutConstants.NULL_LAYOUT_ID) {
View childRootView = getLayoutInflater().inflate(childLayoutID, mLinearLayoutFrameContainer, false);
mLinearLayoutFrameContainer.addView(childRootView);
}
....
setContentView(rootBaseView);
So I have an abstract method
public abstract
@LayoutRes
int getLayoutResId();
In any child action, I return a specific build resource.
All views in BaseActivityare entered correctly, but in any child activity, views cannot be entered even with annotation @Nullable; the view is zero at run time.
How can I solve this problem. maybe there are workarounds?
ADDITIONAL INFORMATION
I tried different ways, for example
ButterKnife.bind(this);
ButterKnife.bind(this,mLinearLayoutFrameContainer);
In a child activity in a method onCreate.
But still the same
, .
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
Log.e("FRAGMENT", "ON VIEW CREATED " + getClass().getCanonicalName());
ButterKnife , , , onViewCreated super.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupViews();