由网友(冷城少年终享孤独)分享简介:我有code像tthis:I have code like tthis:String s = "replace__menu__" + data.imageid + ".png";int RID = this.getApplicationContext().getResources().getIdentifier(...
我有code像tthis:
I have code like tthis:
String s = "replace__menu__" + data.imageid + ".png";
int RID = this.getApplicationContext().getResources().getIdentifier(s, "drawable-hdpi", getPackageName());
在的String = 的指令设置一个值,该值是一样的名字在我的RES /绘制,华电国际文件之一。但是,返回的值集的 RID 应用于值的 0 的
The String s = instruction sets a value that is the same as one of names in my res/drawable-hdpi folder. However, the returned value sets RID to the value 0
任何想法,为什么我的code不工作?难道我做错了什么?
Any idea why my code is not working? Am I doing something wrong?
推荐答案
试试这个
String s = "replace__menu__" + data.imageid; // image name is needed without extention
int RID = this.getApplicationContext().getResources().getIdentifier(s, "drawable", getPackageName());
相关推荐
最新文章