我正在尝试使用字符串数组从 XML 获取资源,因为它当前处于循环中。
谁能告诉我如何做到这一点?
为了清楚起见,资源名称与数组字符串名称同名。
到目前为止我已经尝试过:
mMainEngine.mContext.getString(R.string.class.getField(Modification.ModicationNames[Current]).getInt(null)),
最佳答案
我没有误会你
int id = getResources().getIdentifier("name_of_resource","string", getPackageName());
是你需要的
关于java - 通过数组中的字符串名称访问资源字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16732945/