开始集成环信easeui,发现不能发送图片。并且提示一下错误
经过多方核实↓↓↓↓↓↓↓↓↓↓↓
在环信easeui的demo中
EaseChatRowImage类中
private void showImageView(final String thumbernailPath, final String localFullSizePath, final EMMessage message) {
// first check if the thumbnail image already loaded into cache s
Bitmap bitmap = EaseImageCache.getInstance ().get (thumbernailPath);
if (bitmap != null) {
// thumbnail image is already loaded, reuse the drawable
imageView.setImageBitmap (bitmap);
} else {
imageView.setImageResource (R.drawable.ease_default_image);
DownLoadImageTask downLoadImageTask = new DownLoadImageTask ();
downLoadImageTask.execute (new String[]{thumbernailPath, localFullSizePath});
/* AsyncTaskCompat.executeParallel( new AsyncTask<Object, Void, Bitmap>() {
@Override
protected Bitmap doInBackground(Object... args) {
File file = new File(thumbernailPath);
if (file.exists()) {
return EaseImageUtils.decodeScaleImage(thumbernailPath, 160, 160);
} else if (new File(imgBody.thumbnailLocalPath()).exists()) {
return EaseImageUtils.decodeScaleImage(imgBody.thumbnailLocalPath(), 160, 160);
}
else {
if (message.direct() == EMMessage.Direct.SEND) {
if (localFullSizePath != null && new File(localFullSizePath).exists()) {
return EaseImageUtils.decodeScaleImage(localFullSizePath, 160, 160);
} else {
return null;
}
} else {
return null;
}
}
}
protected void onPostExecute(Bitmap image) {
if (image != null) {
imageView.setImageBitmap(image);
EaseImageCache.getInstance().put(thumbernailPath, image);
}
}
});*/
}
}
该红色文本有问题,将该文本替换成
class DownLoadImageTask extends AsyncTask<String, Void, Bitmap> { String s = ""; @Override protected Bitmap doInBackground(String... params) { s = params[0]; File file = new File (params[0]); if (file.exists ()) { return EaseImageUtils.decodeScaleImage (params[0], 160, 160); } else if (new File (imgBody.thumbnailLocalPath ()).exists ()) { return EaseImageUtils.decodeScaleImage (imgBody.thumbnailLocalPath (), 160, 160); } else { if (message.direct () == EMMessage.Direct.SEND) { if (params[1] != null && new File (params[1]).exists ()) { return EaseImageUtils.decodeScaleImage (params[2], 160, 160); } else { return null; } } else { return null; } } } protected void onPostExecute(Bitmap image) { if (image != null) { imageView.setImageBitmap (image); EaseImageCache.getInstance ().put (s, image); } } }
使用方法