Android - What is the best way to maintain multiple images?
During my game loop I am constantly loading images using
BitmapFactory.decodeResource(getResources(), R.drawable.objectx);
开发者_开发知识库Most of the time I'm calling images that have already been decoded earlier. Am I slowing down execution by decoding the resource every time?
Is it better to store every image into a Map (or Dictionary) at the beginning of the program? If so, how do you get the resource IDs for all images in the drawable folder?Is it better to store every image into a Map (or Dictionary) at the beginning of the program?
Yeah... it's much better. Or you can store them as soon as you need them; is not necessary to store them all at the beginning.
If so, how do you get the resource IDs for all images in the drawable folder?
The drawable folder does not contains images only; it also have xml resources. So that's not the way to go.
精彩评论