CustomResManage.java
android 系统通过R对象获取系统资源 自定义R对象,通过自定义对象,实现资源的映射关系; 通过资源名称,资源类型,程序包名获取资源的映射ID,通过对应的资源获取方法,获取该ID对应的资源对象 例如: 获取string资源: int id = context.getResources().getIdentifier(iconName, "string", context.getPackageName()); String str = context.getResources().getString(id); 获取Drawable资源: int id = context.getResources().getIdentifier(iconName, "drawable", context.getPackageName()); Drawable drawable = context.getResources().getDrawable(id);