public static int getResourceId(String resName) {
try {
java.lang.reflect.Field field = R.drawable.class.getField(resName);//记得做混淆处理
return Integer.parseInt(field.get(null).toString());
} catch (Exception e) {
Log.d("TAG", "faild to get resource ID !");
}
return 0;
}
try {
java.lang.reflect.Field field = R.drawable.class.getField(resName);//记得做混淆处理
return Integer.parseInt(field.get(null).toString());
} catch (Exception e) {
Log.d("TAG", "faild to get resource ID !");
}
return 0;
}