I want use many bitmap for my game canvas.
I can't Recycle
bitmaps, because I have to use bitmaps for the whole section.
Do mention some guidelines to optimize the code to handle many bitmap also faster performance for my canvas based Game Application.
Currently i am using the following code to get bitmap from drawable resource,
BitmapFactory.Options bfOptions=new BitmapFactory.Options();
bfOptions.inSampleSize = 1;
bfOptions.inDither=false; //Disable Dithering mode
bfOptions.inPurgeable=true; //Tell to gc that whether it needs free memory, the Bitmap can be cleared
bfOptions.inInputShareable=true; //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
bfOptions.inTempStorage=new byte[16 * 1024];
myBitMap=BitmapFactory.decodeResource(getResources(),ID, bfOptions);
I am currently following this code for drawing in canvas.
the images are in sprite so while trying to load many sprite its giving problem.
In this code link MainGamePanel.java is what i am doing exactly . for bitmap decoding i use the above method.