I'm developing an Android Game application that requires loading a lot of images(png). I used BitmapFactory.decodeStream to load the images:
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inScaled = false;
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeStream(context.getResources().openRawResource(context.getResources().getIdentifier(filenames.get(i),"drawable",context.getPackageName())),null,opt);
It works fine on Samsung S1 i9000(Android 2.3.3). But when I test it on Samsung S2 i9100(Android 4.1.2) it crashes when I load the images.
I launched DDMS to check the heap and found out something weird. It seems S1 only allocated 5.494mb for my application, when S2 allocated over 43.280mb!
I would really appreciate if someone could tell me why there's such big difference between these two phones.
Screenshot image