Resources resources = context.getResources();
intindentify = getResources().getIdentifier("icon", "drawable",context.getPackageName());
如果找到了,返回资源Id,如果找不到,返回0 。
intindentify =
- 第一个参数为ID名,第二个为资源属性是ID或者是Drawable,第三个为包名。
如果找到了,返回资源Id,如果找不到,返回0 。