我们都知道,Android中在一个Activity或是service中可以用this.getString(R.string,test);来获取字符串,但如果这样呢?
publicclass myTestClass{ public static
final String MYTEST = "this is a
test"; //如果这个字符串是在string.xml中,该如何获取该值
//this.getString()无法获取
}
我们都知道,Android中在一个Activity或是service中可以用this.getString(R.string,test);来获取字符串,但如果这样呢?
publicclass myTestClass{ public static
final String MYTEST = "this is a
test"; //如果这个字符串是在string.xml中,该如何获取该值
//this.getString()无法获取
}
如果你想要系统级别的,可以这样.
Resources.getSystem().getString(android.R.string.xxxxxx);
android.R.string.xxxxxx 为系统中已经定义的资源.