You cannot start a load on a not yet attached View or a Fragment ...

项目app出现标题上的错误,定位到代码中的这句:

Glide.with(getContext()).load(hairdresserDetail.getHead_photo())
                    .into((CircleImageView) newsHeader.findViewById(R.id.head_photo));

Glide加载图片报错?百度下,还真有类似的情况,详解请看如下链接

https://blog.csdn.net/loners_/article/details/73521968

看了上面博主的文章分析,可能是activity被销毁,而getContext()传入了空值导致的。加上以下判断

if(getContext()!=null){
            Glide.with(getContext()).load(hairdresserDetail.getHead_photo())
                    .into((CircleImageView) newsHeader.findViewById(R.id.head_photo));
        }

再测未复现标题所示的错误。

猜你喜欢

转载自blog.csdn.net/yun382657988/article/details/83273469