On my application I have many pictures which I have grouped in folder under res/drawable. But Android dosen’t let me access them trough “R”. Is there a way to access those folders.
This is the Code im using for.
ImageView iv = new ImageView(conext);
iv.setImageResource(R.drawable.**smiley.666**);
I marked the part which I can’t access.
Thx in Advance
safari
No, Android does not allow subfolders under
/res/drawable: Can the Android drawable directory contain subdirectories?You can however, add all image files under
/drawableand then access them programmatically via:Where
drawableNameis a name of the drawable file, i.e.myimageif image file ismyimage.jpg.The code above will get image resource with id
R.drawable.drawableName.