在数组字符串名称访问资源字符串字符串、数组、名称、资源

2023-09-13 02:10:53 作者:别松手我怕黑èi

我想从使用XML字符串数组的资源,因为它是目前在一个循环。

谁能告诉我如何做到这一点?

资源名称是相同的名称作为数组字符串名称仅仅是明确的。

到目前为止,我曾尝试:

mMainEngine.mContext.getString(R.string.class.getField(Modification.ModicationNames[Current]).getInt(null)),

解决方案

我还没有missunderstood你

 内部ID = getResources()则getIdentifier(name_of_resource,弦,getPackageName())。
 

是你neeed

Labview如何把字符串数组转为字符串

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