如何从文件夹绘制图像中的android?文件夹、图像、android

2023-09-06 19:22:48 作者:夏威夷最后一句 baby°

我的工作测验的应用程序。我存储在SQLite数据库下面的表格列数据。

I am working on quiz application. I stored the column data in the following form in sqlite database.

我能够找回这个问题,但现在我需要检索的特定问题的图像。我在绘制文件夹中保存的图像。但我需要的即SRC =/测试/ image1.png进入src =/绘制/ image1.png。如果我改变喜欢的路径路径 图像中的SQLite科拉姆的话,我可以让我保持我的绘制文件夹中的形象?请帮我对此...

I am able to retrieve the question but now I need to retrieve the image of that particular question. I kept the images in drawable folder. But I need to change the i.e src="/test/image1.png" to src="/drawable/image1.png". If I change the path like the path of the image in sqlite colum at then can I get the image which I kept in my drawable folder? Please help me regarding this...

在此先感谢

推荐答案

我会坚持,在数据库中你可以举个形象的名字,然后就可以得到图像使用getIdentifier,

I would insist that in database you can just give the name of the image and then you can get the image using getIdentifier,

getResources().getIdentifier(name,"drawable", getPackageName());

在哪里的名字将是你的形象,即名称 - 此搜索