空指针异常
qyliuyawei opened this issue · 3 comments
qyliuyawei commented
平时测试都没有什么问题,但是在后台却收集到了很多空指针异常的问题;
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup)' on a null object reference
at com.classic.common.MultipleStatusView.inflateView(MultipleStatusView.java)
at com.classic.common.MultipleStatusView.showEmpty(MultipleStatusView.java)
at com.classic.common.MultipleStatusView.showEmpty(MultipleStatusView.java)
MultipleStatusView是直接下载布局里面的,通过butterknife来绑定的控件;
求解答;
LambdaV5 commented
mInflater = LayoutInflater.from(getContext());
把这段代码放在构造函数,然后detach的时候不用置空,并不会引起内存泄漏