how to get images dynamically from drawable folder

Solution 1:

You can use getIdentifier()

for (int j = 1; j < 6; j++) {
   Drawable drawable = getResources().getDrawable(getResources()
                  .getIdentifier("d002_p00"+j, "drawable", getPackageName()));
}

Solution 2:

You can also use this:

int res = getResources().getIdentifier("<your pakecgename>:drawable/abc", null, null);