The error occurs because all your drawables are decoded as bitmaps. Consider to store the int
id in your Collection
(like R.drawable.someimagename
) and get the real Drawable
object just in time when it's needed.
Since you have constant number of entries with indices from 0-21, you can use an array:
int[] groundForceDrawables = new int[22];
groundForceDrawables[0] = R.drawable.sotamies_kauluslaatta;
groundForceDrawables[1] = R.drawable.korpraali_kauluslaatta;
// and so on
When you really need to draw the image at index i:
Drawable myCurrentDrawable = getResources().getDrawable(groundForceDrawables[i]);
This will only be suitable if you do not have to display all the drawables at the same time. If you have to keep the Drawable objects in cache together since you have to display them all at the same time, I still recommend to scale them down, your heap will be large enough to save Bitmaps to fill the screen unless their resolution is needlessly high.
Also you can increase your heap size if you haven't done that already: How to increase heap size of an android application?