Java 使用路径sqlite将可绘制图像设置为imageview

Java 使用路径sqlite将可绘制图像设置为imageview,java,android,Java,Android,如果您能帮助我,我将不胜感激。我正在尝试显示我的drawable文件夹中的图片,这些图片的名称位于sqlite数据库中 问题是我无法在imageview上应用图像。你知道为什么会这样吗。谢谢 这是我的密码 setviewholder.java public class SetViewHolder extends RecyclerView.ViewHolder { public ImageView txt_imagen; public TextView txt_path_imagen; publ

如果您能帮助我,我将不胜感激。我正在尝试显示我的drawable文件夹中的图片,这些图片的名称位于sqlite数据库中

问题是我无法在imageview上应用图像。你知道为什么会这样吗。谢谢

这是我的密码

setviewholder.java

public class SetViewHolder extends RecyclerView.ViewHolder {
public ImageView txt_imagen;
public TextView txt_path_imagen;

public SetViewHolder (View itemView){
super(itemView);
txt_imagen = (ImageView) itemView.findViewById(R.id.txt_imagen);
txt_path_imagen = (TextView) itemView.findById(R.id.txt_path_imagen);
}
自定义\u列表\u item2.xml

<ImageView
 android:id="@+id/txt_imagen"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 />
日志:

Unable to decode the stream: java.ioFileNotFoundException: /ar.comm.allnight:drawable/imgage1
我尝试了很多不同的方法,但我不能让它工作,其他的VAR显示ok!,所以现在一切都好了


知道我做错了什么吗?

试试这个Drawable Drawable=getResources().getDrawable(getResources().getIdentifier(“d002_p00”+j,“Drawable”,getPackageName());我不能让它工作,我见过几个例子使用,但都使用:getDrawable和getResources不推荐使用,你能重新编写代码吗,我使用AndroidStudio 2.2使用这个ContextCompat.getDrawable(getActivity(),R.drawable.name);尝试这个Drawable Drawable=getResources().getDrawable(getResources().getIdentifier(“d002_p00”+j,“Drawable”,getPackageName());我不能让它工作,我见过几个例子使用,但都使用:getDrawable和getResources不推荐使用,你能重新编写代码吗,我使用AndroidStudio 2.2使用这个ContextCompat.getDrawable(getActivity(),R.drawable.name);
Unable to decode the stream: java.ioFileNotFoundException: /ar.comm.allnight:drawable/imgage1