[代码]方法一:
int i= field.getInt(new R.drawable());
Log.d("icon",i+"");
}catch(Exception e){
Log.e("icon",e.toString());
Resources res=getResources();
int i=res.getIdentifier("icon","drawable",getPackageName());
Log.i("res",Integer.toString(i));
try{
Field field=R.drawable.class.getField("icon");int i= field.getInt(new R.drawable());
Log.d("icon",i+"");
}catch(Exception e){
Log.e("icon",e.toString());
}
Resources res=getResources();
int i=res.getIdentifier("icon","drawable",getPackageName());
Log.i("res",Integer.toString(i));