Android :: Android - Image Cache Stategy And Memory Cache Size

Jun 21, 2010

I'm implementing an image cache system for caching downloaded image.

My strategy is based upon two-level cache:
Memory-level and disk-level.

My class is very similar to the class used in the droidfu project

My downloaded images are put into an hashmap and the Bitmap objet is wrapped inside a SoftRererence object.

Also every image is saved permanently to the disk.
If a requested image is not found into the Hashmap<String,SoftReference<Bitmap>> it will be searched on the disk, readed, and then pushed back into the hashmap. Otherwise the image will be downloaded from the network.

Since I store the images into the phisical device momery, I have added a check for preserve the device space and stay under a 1M of occupied space:

CODE:.................

This method is called sometime afte a disk writing:

CODE:..............

What I'd like to add is the same check on the HashMap size to prevent it will grow too much. Something like this:

CODE:.....................

My question is:
What could be a right MAX_MEMORY_SIZE value? Also, Is it a good approach? A good answer also could be: "Don't do it! SoftReference is already enough"

Android :: Android - Image cache stategy and memory cache size


ADVERTISEMENT

Android :: Check Cache Size For Bitmaps / Fix Maximum Size Of It?

Jun 30, 2010

I manage a cache of bitmap. Do you have an advise to fix the maximum size of it?

View 2 Replies View Related

General :: Disable Moving Of System Dalvik Cache To /cache?

Aug 16, 2012

In cm roms, dalvik cache of system apps are generated in /cache but those data/apps are generated in /data. Is there any way to disable this behaviour? Cache partition in our phones is too small. In AOSP and AOKP and stock roms, dalvik cache is always generated in /data no matter whether its a system app. any way to achieve this in cm roms?

View 1 Replies View Related

Android : Way To Control An App's Cache Size?

Aug 10, 2010

My app has a WebView which displays Google maps. I'm trying to limit the cache size to a reasonable one - like 2MB. After checking with settings->applications->manage applications I found out that regular page load gets the cache to 900kb. And dispite my efforts, I can't limit the cache size or monitor when the cache limit is being reached. If I'm playing with the map on the webview, the app can even reach 10MB and no "ache max size reached" message is received.

View 2 Replies View Related

Android :: Configure The Web Browser Cache Size?

Jul 30, 2009

Configure the web browser cache size? In HTC's new product HERO, they limit the cache size from 100KB to 6MB, and user can configure it manually. It can prevent browser sucking up memory space too much.

View 2 Replies View Related

General :: How To Limit Cache Size

Jun 9, 2012

I do really love cloud computing... But, Google seems to have forgot something: set a limit to the cache size.

I have a Nexus S and my poor 16Gb internal memory is saturated because of caches: Google+, Android Gallery (Picasa), Google Music and Google Listen all fight for the sdcard space.

The only apps who have explicit cache settings is Google Listen... The others don't have obvious options. I have 10K songs, 10-20K photos, etc.. I need to access them, but I need to limit the cache size.

Is there a way to easily limit cache size per apps?

View 1 Replies View Related

Android :: Clear Cache Memory When Application Exits Programmatically?

Aug 31, 2010

I have set of images fetched from internet and set it on gridview,here i have option to click here to view more,below the grid view and it fetches images and set it on grid with prevoius set of images,when i exit the application and run it again,the previous set of images remain in cache and grid shows images from cache,here i need to clear my application cache memory,when i exited my application.how can i get it.

View 1 Replies View Related

Android :: Cleaning An Image Cache Directory On SD Card?

Apr 1, 2010

I've got an app that is heavily based on remote images. They are usually displayed alongside some data in a ListView. A lot of these images are new, and a lot of the old ones will never be seen again.

I'm currently storing all of these images on the SD card in a custom cache directory (ala evancharlton's magnatune app).

I noticed that after about 10 days, the directory totals ~30MB. This is quite a bit more than I expected, and it leads me to believe that I need to come up with a good solution for cleaning out old files... and I just can't think of a great one. Maybe you can help. These are the ideas that I've had:

Delete old files. When the app starts, start a background thread, and delete all files older than X days. This seems to pose a problem, though, in that, if the user actively uses the app, this could make the device sluggish if there are hundreds of files to delete. After creating the files on the SD card, call new
File("/path/to/file").deleteOnExit(); This will cause all files to be deleted when the VM exits (I don't even know if this method works on Android). This is acceptable, because, even though the files need to be cached for the session, they don't need to be cached for the next session. It seems like this will also slow the device down if there are a lot of files to be deleted when the VM exits. Delete old files, up to a max number of files. Same as #1, but only delete N number of files at a time. I don't really like this idea, and if the user was very active, it may never be able to catch up and keep the cache directory clean.

View 1 Replies View Related

General :: Can Dalvik-cache Size Be Limited?

May 15, 2012

I am wondering if it is possible to limit the size of the dalvik-cache. I am looking for an alternative to putting it on the sdcard. Maybe I could create a partition on the internal storage for the cache?

View 1 Replies View Related

General :: Google+ Application Cache Size Is Huge?

Jan 15, 2012

I went to do a nandroid backup and it failed, "no space on my SD card".

Thats weird, as usually have at least 4 gig on my Nexus S 4g.

Poking around, it was the cache from Google plus,).[url].... That, coupled with my titanium backup of same ate my SDCARD. easy to fix Titanium from backup it up, but the cache is still several gigs large. 40,000 + files with [number].screen extensions.

I have like 2 friends on google+, 3 posts, and can not for the life of me figure out what in the world all that data is.

I'm going to remove the data , freeze the app, but just wanted to know if noticed a disproportionate amount of data in the Google+ app compared to the amount of activity/usage I have on google+.

View 2 Replies View Related

Android : Browser Cache - Previous History In Order To Save Internal Phone Memory

Nov 28, 2008

There are a couple of options within the browser I didn't find until after searching for it, so I thought I would share it with the rest of the community in order to help out.

-Everyone should clear the browser cache and previous history in order to save internal phone memory. To do this go to BROWSER press the MENU button and press MORE. There should be a list of things in there but what you should be interested in is the last item which is SETTINGS. From there in privacy settings there will be options to clear both cache and history.

- Another little tip I wanted to share was viewing webpages in landscape mode without opening your keyboard. To do this simply press the MENU button from within the BROWSER and go down to FLIP ORIENTATION. You should realize tho by doing this you browser will continue to be in landscape the next time it's used. In order to return it to it's normal portrait mode just follow these steps once again.

-There are a number of other things you can mess around with or find with the MENU button within the browser so just take a look at it yourself even if you don't want to do any of these tips.

View 12 Replies View Related

General :: How To Clean Cache / Files In Memory

Mar 21, 2014

I bought a Samsung Galaxy S2 Hercules (T-Mobile) and its used. In the Last week I pull some photos and mistakenly delete them, but with my "Recurva" program i could see all the photos (mine and others owners)

On the one hand I'm happy for having recovered, but if one day I want to permanently delete photos, I have the fear that the other person recovers.

How I can delete all photos, videos and files in the cache memory?

View 2 Replies View Related

General :: Which Video Players Allow To Set Network Buffer Cache By Size And Time

Dec 26, 2012

The closest I know of are mxplayer and vplayer. Any xda alternatives people know of?

View 2 Replies View Related

HTC Eris :: Internal Memory Slowly Dropping - Cache To SD?

Jul 24, 2010

I'm using apps to sd, and have been noticing my internal memory slowly dropping. If I remember correctly, this is due to apps storing their cache there. Any way to direct it to the sd card?

View 4 Replies View Related

HTC Desire :: Internal Memory Full Only 35MB / Applications And Cache

Nov 8, 2010

Moved to troubleshooting.

View 2 Replies View Related

Android :: Clear Browser Cache

Dec 31, 2009

How do you clear the cache on the browser?

View 11 Replies View Related

Android :: App Builds Up Large Cache

Aug 17, 2010

When I test my app, I notice that after some use it has built up a fairly large cache of several Mb. I see this when I go to Menu-

View 9 Replies View Related

Android :: Return Value Of Get Drawing Cache

Jun 17, 2009

From the JavaDoc, it said it returns 'a bitmap representing this view or null if cache is disabled'. My question is what if the View is longer than the phone screen (you need to scroll vertically), what does the bitmap return? * only the visible portion of the view * everything the view has (both visible + invisible part)

View 4 Replies View Related

Android :: Cache Supposed To Be Accessible?

Mar 18, 2009

My app is downloading a file that does not need to be kept. So I was trying to put it in the directory returned by Environment.getDownloadCacheDirectory() (that returns "/cache").
But apparently it is not accessible, (a FileNotFoundException is thrown).

View 4 Replies View Related

Android :: Pragma - No-cache Not Supported?

Sep 3, 2010

I work on an application to display a remote page in a webview. The page contains a simple input form and an image. The image is updated automatically by server using specific header. The page is never displayed.

Searching on the web to find a way to resolve this issue.

I read this : http://remotedroid.net/blog/2009/11/13/android-browser-caching/ "Pragma: no-cache, and all the other server-side headers also have no effect as far as I can tell."

Do you have a work around ?

View 2 Replies View Related

Android :: Cant Clear Cache On Some Apps

Apr 27, 2010

I have a couple apps I have noticed when I open a file it must cache the file internally, but gives me no way to clear. For example Zumodrive and repligo reader both will show 20+mb in my settings, but clear cache is greyed out and shows 0mb. However when I delete these apps and reinstall them, I get all that internal memory back. I am running a rooted Nexus One.

View 3 Replies View Related

Android :: Counting Files In A Cache

Nov 3, 2010

I'm trying to manage the files that I store in a local cache. I download files, then delete them after the total file size in the cache exceeds a certain number of bytes. What I'm shooting for right now is something simple: setting the max cache size to be 1 MB, or 1*1024*1024 bytes = 1048576 bytes. I have a method that gets the cache directory, then does a listFiles() on that File to get all children of the directory. I have a flat cache structure, no subdirectories, so simply calling f.length() on every child should give me my total cache size right?

Well what I'm finding is that the amount I count is about 0.9 of size reported in Manage Applications > Application Info for my app, in the Cache section.

Am I making a bad assumption that File.length() will actually return to me the size, in bytes, of a file on disk? I also wonder also if disk space in the Cache directory is being used by Android at all for some reason I'm unaware of.

View 4 Replies View Related

Android :: Application Cache Data?

Oct 20, 2010

I'm trying to understand the way android handles my application cache data....Some times i'll go in there and the cache directory is 6-7mb. What type of data is stored there? Is there a way in the mainifest I can say don't use cache or clear cache at Xmb ?

View 5 Replies View Related

Android :: XML Parsing Slow - Cache

Aug 16, 2010

I have seen that xml parsing is very slow. Using sax would be better, but benchmark show that sax work only 30% faster as dom. Is right? Is faster if I construct a "DOM" using sax?

To reduce time i like to cache xml file. Caching it as xml is not a good idea because the parsing time is there again the secondo time.

Should I use sqllite? Is faster? Is an idea to use an ObjectOutputStream? Can I put in asset a file maked by ObjectOutputStream or the serialized objects can be different in different mobile hardware?

View 5 Replies View Related

Android :: Can't Open Dex Cache Error With SDK 1.1

Mar 4, 2009

Recently I switched to SDK 1.1 and it worked for a short time without any problems. Now I'm getting "Can't open dex cache '/data/dalvik- cache/system ..." error and emulator doesn't start at all. Just shows Android screen of death with blinking cursor. When I repoint Eclipse back to 1.0 r2 it works fine. I did adb shell and /data folder is empty.

View 2 Replies View Related

Android :: Slacker Radio Cache?

Jan 22, 2010

Coming from a Blackberry Storm, I had Slacker Radio and it was one of the first apps I downloaded on my new Eris yesterday. However, I am finding that the ability to cache radio stations to your media card is missing from the features of the Android app. The cache was extremely useful as it wouldn't force the data connection and thus helped to conserve battery life.

Is there an alternative app for radio that will cache stations or do I need to hit up the Slacker team to get an update to the Android App?

View 4 Replies View Related

Android : How To Move WebView Cache To SD?

Aug 2, 2010

I've seen some apps like dolphin browser (not the HD version, the normal one) utilizing a cache-to-sd for webview but i can't seem to figure out how to do this, does anyone know how to do this or point me in the right direction?

View 1 Replies View Related

Android : How To Clear Cache Without Rooting?

Aug 26, 2010

is there a good app that can clear my phones cache without having to root my phone, a free app? i couldn't find one and is it bad to delete cache? dont i need it on my phone, at least some?

View 2 Replies View Related

Android : Way To Clear Cache On All Apps?

Feb 14, 2010

I searched and found many posts regarding clearing cache. But didn't find this answer. Is there a way to clear cache on all apps at once? I went through the settings/applications/manage apps, and checked and cleared cache on many, but this is real tedious, but seemed to give great results. Phone feels much faster. (NOT ROOTED) Psychological? Dunno, but question still stands, does anyone know an easy way to do this? Additionally, is there any risk of clearing cache from any apps?

View 10 Replies View Related

Android : Clearing The Cache Of Your App On Exit

Jul 24, 2009

Is it possible to force the cache of your app to clear when the user exits the app? My app piles up cache data (rightfully so) on each start, which is no longer needed once the user quits the app, so I am trying to find a way to forcibly clear it.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved