In the project, the image resources (regular images) in a directory are read to an array or the image name is read from the database. Then, the image is called and R is used directly. drawable .? Unable to call. Summary: 1. instead of placing images under res/drawable, they are stored in a src package (for example, com. chen. in this case, the call method is: String path = "com/chen/resource/imageName.png"; InputStream is = getClassLoader (). getResourceAsStream (path); Drawable. createFromStream (is, "src"); 2. if you still want to directly use the images in res/drawable, you need to use the following method: assume that the package name entered during project creation is com. test. image int resID = getResources (). getIdentifier ("imageName", "drawable", "com. test. image "); Drawable image = getResources (). getDrawable (resID); Method for reading regular images in the drawable directory cyclically: [java] private Integer [] mImageIds = new Integer [45]; for (int I = 0; I <45; I ++) {int drawable = getResources (). getIdentifier ("image _" + (I + 1), "drawable", this. getPackageName (); mImageIds [I] = drawable ;}