public int getId(String str){
Class<R.drawable> cls = R.drawable.class;
int value = 0;
try {
value = cls.getDeclaredField(str).getInt(null);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
return value;
}