如何从文件夹绘制图像中的android? [英] How to get the image from drawable folder in android?

查看:82
本文介绍了如何从文件夹绘制图像中的android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作测验的应用程序。我存储在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...

在此先感谢

推荐答案

我会坚持,在数据库中你可以举个形象的名字,然后就可以得到图像使用<一个href="http://developer.android.com/reference/android/content/res/Resources.html#getIdentifier%28java.lang.String,%20java.lang.String,%20java.lang.String%29"><$c$c>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());

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

这篇关于如何从文件夹绘制图像中的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆