我正在使用Glide从手机内存中加载图像。我的ImageView定义如下:
ImageView ivx=(ImageView)view.findViewById(R.id.ivx);
Glide是一种加载图片的代码,用于将手机中的图像加载到图像视图中,具体代码如下:
Glide.with(getActivity()).load(new File("/storage/emulated/0/somefolder/MEDIA/PROFILEIMAGES/PROFILE_image1.jpg").toString())
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
Log.e("xmx1","Error "+e.toString());
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
Log.e("xmx1","no Error ");
return false;
}
})
.into(ivx);
我一直面临的问题是,这段代码会抛出异常:
Error java.lang.RuntimeException: setDataSource failed: status = 0x80000000
我已经检查了文件,文件在文件夹中!但是Glide没有将图像文件加载到图像视图中!
请问有人可以告诉我我做错了什么吗!
提前致谢!