I think it is asked and asked before, but still, there are things I can't quite understand.
I have tried two different approaches:
In 2. it's just cleaning them up sometimes the second I allocate them! And I don't allocate too much - 30-40 images 50x50 pixels.
So I am sticking to one. The question is what is the limit?
It reduces the time it takes for the user to view the images or Javascript or CSS files. This is because the user now accesses the file from his system instead of getting downloaded over the network. At the same time, caching also reduces the number of requests and data transfer from your servers.
My android project layout xml file has three button. which are shows, events & home. when buttons click they download images from url & save them in cache. So now downloaded are completed once it is clicked.
Open Settings and select Storage. In the resulting list, tap the Apps entry (Other Apps on Android 11 and earlier). This will take you to a list of all the apps installed on your phone. Choose the app whose cache you want to clear.
A cache is a special storage space for temporary files that makes a device, browser, or app run faster and more efficiently. After opening an app or website for the first time, a cache stashes files, images, and other pertinent data on your device.
Most important question: Are you recycle()
-ing your bitmaps? This is very important for pre-Gingerbread applications (maybe post-Gingerbread too).
Watching the Memory Management for Android Apps session from Google I/O 2011 helped me get a better understanding of the peculiarities of developing for Android.
That video mentions a tool called MAT - a Memory Analyzer - which is useful for determining if you have objects hanging around in memory that have been leaked. It's possibly you have more than the 30-40 you think you have.
For viewing and/or logging the current size of heap, etc., I'd suggest using the code in this answer about Android Out of Memory exceptions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With