Reputation: 1
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.
Upvotes: 0
Views: 72
Reputation: 11194
I would suggest you to first create a thubnails of images.
Bitmap ThumbImage = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(imagePath), THUMBSIZE, THUMBSIZE);
Use lazy loading concept
Upvotes: 1
Reputation: 3975
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"
here is an image loader example
Upvotes: 1
Reputation: 3489
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
Upvotes: 0