Я меняю Bind на BindView Class, Как писать правильно Я не знаю, я новичок в кодировании Пожалуйста, помогите мне
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import static butterknife.Unbinder.*;
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// TODO Auto-generated method stub code part
View view = inflater.inflate(R.layout.fragment_device_info, container, false);
Unbinder unbinder = ButterKnife.bind(this, view);
mContext = getActivity();
return view;
}
@Override
public void onDestroyView() {
super.onDestroyView();
Unbinder.unbind();
}
Пожалуйста, помогите мне
Сделайте Unbinder unbinder полем и используйте его вместо него.
Unbinder unbinder; //declare it here
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
...........
unbinder = ButterKnife.bind(this, view); //bind it here
.......
return view;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind(); // then unbind it here on the same Unbinder object
}
Это работает, спасибо
см. эту ссылку, которая может вам помочь stackoverflow.com/questions/290884/…