In my application I have to display an image which is about 10000 x 5000 , using small images of 500x500 px. I.e;thru tiling images. In order to tile all images to one initially am collecting all bitmaps from sdcard in order to draw on canvas.
But while am loading images from extenal storage using BitmapFactory.decodeFile(path)
i encounterd with error java-lang-outofmemoryerror-bitmap-size-exceeds-vm-budget-android
can any one how to avoid this error and gimme an idea how to tile lot of images in to a single image .
Thanking you, Srinivas
Never load any tiles that you don't need. "am collecting all bitmaps from sdcard" suggests that you are decompressing every image you might ever need, which would be the wrong approach.
Use smaller tiles. 256x256 is a good size.
Load them as Config.RGB565 (i.e. 16bpp).
Regularly recycle() Bitmaps you don't need.
Basically you need to implement some sort of most-recently-used (MRU) Bitmap cache.