在数组字符串名称访问资源字符串 [英] Access resource string by string name in array
本文介绍了在数组字符串名称访问资源字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从使用XML字符串数组的资源,因为它是目前在一个循环。
谁能告诉我如何做到这一点?
资源名称是相同的名称作为数组字符串名称仅仅是明确的。
到目前为止,我曾尝试:
<$p$p><$c$c>mMainEngine.mContext.getString(R.string.class.getField(Modification.ModicationNames[Current]).getInt(null)),
解决方案
我还没有missunderstood你
内部ID = getResources()则getIdentifier(name_of_resource,弦,getPackageName())。
是你neeed
I'm trying to get a resource from XML using an array of strings because it's currently in a loop.
Can anyone advise me on how to do this?
The resource name is the same name as the array string name just to be clear.
So far I have tried:
mMainEngine.mContext.getString(R.string.class.getField(Modification.ModicationNames[Current]).getInt(null)),
解决方案
I have not missunderstood you
int id = getResources().getIdentifier("name_of_resource","string", getPackageName());
is what you neeed
这篇关于在数组字符串名称访问资源字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文