This is one of the most asked question by beginners but still I couldn\'t get any help unfortunately. In an activity I have a viewflipper to which I assign imageviews with imag
Bitmaps are handled by native memory. This means that when the GC collects the bitmap's reference, the bitmap's memory is not immediately removed. To clear the bitmap's memory immediately, you can call bitmap.recycle()
.
As for the ViewFlipper, you going to want to find a way to manually unload and reload images as they are displayed to the user. Remember to use recycle(), and don't try to display a bitmap that already was recycled.
Hope this helps :)
to avoid,aquire large heap using this in manifest:
android:largeHeap="true"
and almost all problem solutions are present on these links related to memory out of error,hope that one of them may solve your problem:
meomry-out-of-error
Memory Leak and Out of memory Error using List,LinkedList and HashMap
Memory Leak and Out of memory Error using LRU Cache
Memory Leak and Out of memory Error using Disk LRU Cache
Now what happens over here is every app in android is alotted a specific amount of heap size that is as little as 20mb
Bitmaps take up a lot of memory, especially for rich images like photographs
so whenever you load a heavy image or array of heavy images it exceeds the heap size and android automatically shuts down the app because it was using more than the allotted heap size
Read Documentaion
So whenever you are working with heavy images