I want to know which is the best choice of array implementation in Android to store Bitmaps. Is it a good idea to store bitmaps in ArrayList<Bitmap> or it’s not a good solution.
I am trying to store like 5 different bitmaps created programmatically in my application and store them in array,them draw ’em to e canvas,but it’s not working properly.
Here is what I’m doing :
//beginning
ArrayList<Bitmap> temp = new ArrayList<Bitmap>();
//in some function where mBitmap is been created
temp.add(mBitmap);
//in my custom class which extends View
Bitmap bm = Bitmap.createBitmap(temp.get(temp.size()-1));
mCanvas.drawBitmap(bm);
invalidate();
but the bitmap from temp is never added to my mCanvas.
Any ideas why and which is the best way to store bitmaps in Array in Android/Java?
Better use LruCache for Bitmap caching. Please read Displaying Bitmaps Efficiently