I'm a little bit stumbled:
CASE 1: I tried to make an animation which consisted 26 images (each of them were about 200KB in size). Total was 5,3 MB. The animation worked okay. Images were loaded to memory and all was OK.
CASE 2: Now when I try to make an animation which holds 129 images (each around 30KB and in total 4,6 MB) I get out of memory exception.
I'm tracking memory allocation and in "case 1" the loaded bitmap image size per bitmap after loading is 691200 bytes. In "case 2" the bitmap size per file is around 563520 bytes.
used getRowBytes()
* getHeight()
for calculating
And that's weird, the image size in "case 2" is about 6 times smaller but after loading the sizes are quite same.
This is how i load bitmaps to memory:
for (int i = 0; i <= 128; i++) {
imagesHolder[i] = BitmapFactory.decodeResource(
getApplicationContext().getResources(),
getApplicationContext().getResources().getIdentifier(
"image" + (i + 1) + "", "drawable",
getApplicationContext().getPackageName()));
System.out.println(imagesHolder[i].getRowBytes() * imagesHolder[i].getHeight());
totalSize+=imagesHolder[i].getRowBytes() * imagesHolder[i].getHeight();
System.out.println("TOTAL: "+totalSize);
}
So, how come my small images get so big after loading to memory? All hints appreciated. :)