Android ButterKnife unbinder.unbind();使用过程踩的一些坑

我在BaseActivity的onDestroy方法中调用了unbinder.unbind();释放资源,但是在继承了BaseActivity的Activity的onDestroy方法中释放相关UI控件资源一直失败

如 

if (mpgProductInfo != null) {
    mpgProductInfo.stopTimer();
    mpgProductInfo = null;
}

原因是父类中已经释放掉了布局资源,此时mpgProductInfo==null;所以要将

super.onDestroy();

放在前段代码后面。

猜你喜欢

转载自blog.csdn.net/zcz475421852/article/details/81080752
今日推荐