In my application i have two gallery views. whenever in my gallery images increases I am getting outofmemory exception.How i can handle the memory.please can any one help me?
Thanking in Advance.
In my application i have two gallery views. whenever in my gallery images increases I am getting outofmemory exception.How i can handle the memory.please can any one help me?
Thanking in Advance.
I would suggest you to first create a thubnails of images.
Bitmap ThumbImage = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(imagePath), THUMBSIZE, THUMBSIZE);
Use lazy loading concept
Like Stacks28 suggested, use lazy loading concept. Additional to this, always do recycle()
to your images and if you are still having troubles, add this in your manifest inside application tag : android:largeHeap="true"
i believe that you have many bitmaps that you are doing lots of operations with loading them in memory and not freeing the memory
http://developer.android.com/training/displaying-bitmaps/manage-memory.html
Just use
system.gc();
Runtime.getRuntime().gc();