我正在尝试访问在运行时在 R.java 类中生成的一些字符串资源。
R.java:
public static final class string {
public static final int app_name=0x7f040000;
public static final int eightOvereight=0x7f040030;
public static final int eightOvernine=0x7f040031;
public static final int fiveOvereight=0x7f040027;
public static final int fiveOverfive=0x7f040024;
public static final int fiveOvernine=0x7f040028;
public static final int fiveOverseven=0x7f040026;
public static final int fiveOversix=0x7f040025;
public static final int fourOvereight=0x7f040022;
public static final int fourOverfive=0x7f04001f;
{
在运行时我有:
String current = getStringId(); // assume current = "eightOvereight" after this line
//now I would like to use R.string.eightOvereight. I don't want to use a switch statement.
我可以通过反思来实现这一点吗?