target not be null

旧城等待, 2024-02-17 17:23 141阅读 0赞

1url中没有“http://”
2如果你是用picasso导致的这个问题,那么首先检查URL,再者去检查控件(比如imagview)是否是空的。

private void setUserAvatar(EMMessage message, final ImageView imageView) { try { String avatorUrl = message.getStringAttribute(ConstantInfo.CESUAN_IMAGRURL); Log.e(TAG, "setUserAvatar " + avatorUrl); if (imageView != null) { Picasso.with(context).load(avatorUrl).resize(150, 150).centerCrop().into(imageView); } } catch (EaseMobException e) { e.printStackTrace(); } }

比如我的这个问题,在于加上了final 导致imageview无法动态加载(我的这行代码是加载聊天头像的,会随着发送的消息类型去viewholder中加载不同的控件)。

发表评论

表情:
评论列表 (有 0 条评论,141人围观)

还没有评论,来说两句吧...

相关阅读

    相关 host name may not be null

    这个问题我是在用deviceone开发的时候遇到的。当时觉得真是很奇怪。因为我用ios测试的时候没有这样的问题,但是用android测试的时候,就会出现这个问题,是每一个htt