在应用程序项目中能否使用库项目中定义的资源,例如字符串?如果可以,怎么做? 因为我似乎无法像这样解析我想要解析的字符串:
String title = "sample";
int id = ressources.getIdentifier(title, "string", "com.package");
出现以下异常:
WARN/ ResourceType(278):获取0x00000000号资源值时未找到包标识符 WARN/System.err(278):android.content.res.Resources$NotFoundException: 字符串资源ID#0x0
我在库项目的strings.xml中提供了所需的字符串("sample"),并且甚至可以在R.java中看到它。