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.

Android :: cleaning an image cache directory on SD card?


Android :: Mkdirs Returns False For Directory On Sd Card While The Parent Directory Is Writable

Oct 31, 2010

At some points while running my android application, I need to create a directory on the sd card, for a small number of users this fails and I can't figure out the reason for it... (I've found similar problems caused by the WRITE_EXTERNAL_STORAGE permission missing, it's there and it works for almost all users so I don't think this is reason) When mkdirs returns false I crash the program and log the following java.io.File properties, starting at the directory I want to create, then recursive printing properties of the parent directory and so on...

/sdcard/MyDirectory/Dir1/Dir2 (exists: false, canWrite: false, isDirectory: false, isFile: false);
/sdcard/MyDirectory/Dir1 (exists: true, canWrite: true, isDirectory: true, isFile: false);
/sdcard/MyDirectory (exists: true, canWrite: true, isDirectory: true, isFile: false);
/sdcard (exists: true, canWrite: true, isDirectory: true, isFile: false);
/ (exists: true, canWrite: false, isDirectory: true, isFile: false);

The strange thing is that the parent directory is writable (canWrite=true), I can't print the execute file permission but from what I've read, write is what you need when creating directories... What I've looked at so far is the WRITE_EXTERNAL_STORAGE permission, if the sd card is full and if the sdcard is mounted read only:...........................

View 2 Replies View Related

Android :: Spring Cleaning MicroSD Card?

Sep 14, 2010

I was just browsing my SD card on my computer last night and realized that there is a lot of folders/files left over from programs I uninstalled a long time ago. Has anyone just gone in there and deleted them? I am actually pretty surprised about how much stuff was left over. I guess the unistall is like windows where it doesn't always get everything.

View 3 Replies View Related

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"

View 1 Replies View Related

General :: Failed To Mount /cache (no Such File Or Directory)

Nov 10, 2013

After using Odin to update firmware on my Galaxy Player 5.0 (model g70cwy/xaa), I can no longer get it to start. I get the Failed to mount /cache (no such file or directory) (see attached screenshot.

I tried the factory rest option, it does not seem like any of the options on this screen works.

View 2 Replies View Related

General :: Google Music - Any Way To Change Directory Cache

Jul 9, 2012

Google music app save offline music into internal SD, but i have 30gb free in external SD...

There is a way to change the directory cache?

View 1 Replies View Related

Motorola Droid :: Cleaning Up SD Card / Leftover Folders From Uninstalled Apps

Dec 24, 2009

Anyone know if there is an app (or PC program) that will scan the SD card and determine what folders are no longer needed that are left over from uninstalled apps? I have installed/uninstalled tons of apps and I still see folders on the SD card from apps I know that I no longer have. I have deleted the ones I know are safe to remove but there are some with names that are a little less descriptive of what they were for. I know I could just google each folder name and probably figure each one out individually but I thought there might be an app for it.

View 1 Replies View Related

Android :: Updating Image In Drawable Directory From Code Possible?

Mar 17, 2010

I have a picture in res/drawable directory: res/drawable/picture.jpeg.
Can I dynamically update this picture.jpeg from code? i.e. I want to use another picture to replace this picture in the drawable directory dynamically. If I can, what path should I use to access the picture? Should I use "res/drawable/picture.jpeg"?

View 1 Replies View Related

Android :: Creating A Directory On The SD Card?

Oct 4, 2010

I am trying to have my app create a directory on the root of the SD Card, if that directory does not already exist. When I run the app, the "Creating Home Directory..." toast notification displays, but the directory is not created... What am i doing wrong?? (P.S. permissions are set for writing to external storage)

CODE:.......

Here is my Manifest file:

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

I tried this as well, it didn't work, but it might be a step in the right direction as it creates the directory and populates it with a file from res/raw all in one step:

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

View 3 Replies View Related

Android :: How To Delete Directory From SD Card On Uninstall?

Jul 14, 2010

My application creates directory on SD card for syncronisation purpose. Tell me please, is there any way to delete this directory on uninstall? May be I could add some string to Manifest or catch "uninstall" event or something else?

View 4 Replies View Related

Android :: Create Directory Automatically On SD Card?

Jan 25, 2010

Im tyring to save my file to the following location FileOutputStream fos = new FileOutputStream("/sdcard/Wallpaper/"+fileName); but im getting an exception java.io.FileNotFoundException

But when I put the path as "/sdcard/" it works.

Now im assuming that Im not able to create directory automatically this way.

How to create a directory and sub-directory via code.

View 1 Replies View Related

Android :: Get A List Of Files From A Directory On Sd Card?

Sep 15, 2010

I'm happy reading and writing to a pre-set file, and could manually populate a listview, but I'm hoping there is an official(or not) filebrowser I missed, or other more elegant solution to present the user with a directory listing, and let them select a file.

View 2 Replies View Related

Android :: Get A List Of All Mp3 Files On The Sd Card Regardless Of Directory?

Jul 10, 2010

Using code from open source MusicDroid with the following code that I found during a search for this problem, I can only get mp3 files that are in the root directory /sdcard/

CODE:........

How can I get all the mp3 files from the card (in any directory) into my 'songs' list?

View 1 Replies View Related

Android :: Create Directory On The SD Card And Copy Files From - Res - Raw

Oct 3, 2010

I am trying to create a folder and several subdirectory within it on the SD Card... I then want to transfer files that I have stored in /res/raw to that folder... I addition, I want this to only happen once, the first time the program is ever run. I realize that this is ridiculously open-ended, and that I am asking a lot...

View 1 Replies View Related

Android :: Limit For The Number Of Files In Directory On An SD Card?

Apr 16, 2010

I have a project written for Android devices. It generates a large number of files, each day. These are all text files and images. The app uses a database to reference these files.

The app is supposed to clear up these files after a little use (perhaps after a few days), but this process may or may not be working. This is not the subject of this question.

Due to a historic accident, the organization of the files are somewhat naive: everything is in the same directory; a .hidden directory which contains a zero byte .nomedia file to prevent the MediaScanner indexing it.

Today, I am seeing an error reported:

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

Regarding the sdcard, I see it has plenty of storage left, but counting

$ cd /Volumes/NO_NAME/.hidden
$ ls | wc -w
9058

Deleting a number of files seems to have allowed the file creation for today to proceed.

Regrettably, I did not try touching a new file to try and reproduce the error on a commandline; I also deleted several hundred files rather than a handful.

However, my question is: Are there hard limits on filesize or number of files in a directory?
am I even on the right track here?

Nota Bene: The SD card is as-is - i.e. I haven't formatted it, so I would guess it would be a FAT-* format.

The FAT-32 format has hard limits of filesize of 2GB (well above the filesizes I am dealing with) and a limit of number of files in the root directory. I am definitely not writing files in the root directory.

View 3 Replies View Related

Android :: Saving Created Bitmap To Directory On Sd Card

Nov 24, 2010

I created a bitmap and now i want to save that bitmap to a directory somewhere. Can anyone show me how this is done.

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

WANT TO SAVE _bitmapScaled to a folder on my SD card

View 2 Replies View Related

Android :: ARM Directly Read / Write File On Sd Card I/O Without Cache

Nov 16, 2010

I need to directly read/write a file on sd card without cache. I can use "posix_fadvise" to achieve the purpose on Ubuntu I try NDK to make the function call, but it seems disabled on Android How can I do?

View 4 Replies View Related

Android :: 2.2 - SD Card File Directory List Now In Reverse Alphabetical Order?

Jul 24, 2010

I don't see anything about this change in the API differences report at http://developer.android.com/sdk/api_diff/8/changes.html. However when my Nexus One started running Android 2.2, the list of files created by the following code are now in reverse alphabetical order rather than alphabetical order (as they were with Android 2.1 and earlier, AFAIK):

CODE:.........

The line "Arrays.sort(fn);" revives the alphabetical order of the list, but sorts are computationally expensive and AFAIK the explicit call to Arrays.sort() was unnecessary prior to Android 2.2.

In addition to seeing this order change on the Nexus One, it can be confirmed on the emulator running level 7 and level 8 AVDs.

View 4 Replies View Related

HTC Incredible : Need To Clear SD Card Cache

Oct 24, 2010

so I was jokin around with my friend at a bar and we started looking up naughty pictures with a free pron program that I found on the market. We were comparing the people in the bar to the people in the photos and we found some hilarious matches. Anyway, that was last Thursday. Now I see that the pictures that were pulled up on my phone are now easily viewable by merely trying to attach a picture to a text message or an email. Basically, if anyone looks at my phone and tries to see my pictures or something they will see these stupid pictures. The phone says these pictures are saved in the SD Card Cache. How can I clear this cache? I've unmounted the card, twice. No go. I've uninstalled the horrible program (it was free and you get what you pay for, I guess). I needs me some help! I've been perusing the interwebs looking for help and this forum seemed like the most active place right now.

View 2 Replies View Related

Android :: Avoid DDMS Timeout When Pushing Large Directory To Emulated SD Card?

Mar 23, 2010

I have a large directory (about 700 MByte) I'm trying to push to a 4 GByte emulated SD card (in a Platform 2.1 AVD) by dragging and dropping the directory onto the ddms file explorer's /sdcard directory, but ddms is timing out after about 20 MByte of pushing. The following command line error message appears:

34:05 E/ddms: ADB rejected shell command (ls -l /) Failed to push the items: timeout

When ddms is connected to an actual device (Nexus One), the same drag and drop operation successfully completes.

I looked but didn't see any mention of timeout control options in the ddms documentation at http://developer.android.com/intl/de/guide/developing/tools/ddms.html or the Dev Tools application running on the emulator. Has anyone experienced this or have a tip to fix it?

View 2 Replies View Related

HTC Incredible :: Directory Setup On Micro SD Card?

Jun 2, 2010

Are there specific directories that should be setup for Android to understand what is in them? Like a "MP3" directory for music or "images" for photos etc.?

View 8 Replies View Related

Media :: Brought Sd Card Over From BB - Files/directory?

Aug 24, 2010

Brought over my 8GB Sandisk from my BB. Obviously over the past year it added a bunch of files and folders to the card for miscellaneous app data, music, pics, etc. Would I gain any speed on the device by reformatting the card and letting it start fresh in it's new home and re-syncing music and photos into fresh android directories?

View 2 Replies View Related

General :: Move Gallery Cache To SD Card?

Nov 14, 2012

My gallery cache is close to 2gigs. Syncing from Picasa...

Any way to move it my SD Card? If I clear the cache, it just re-downloads and creates new ones.

Currently internal storage cache: SGH-I317MPhoneAndroiddatacom.sec.android.gallery3d

View 3 Replies View Related

HTC Incredible :: Phot Albums Showing SD Card Cache

May 2, 2010

When I delete a file with astro the SD card cache is populating files which are being shown in my albums picture (gray pics). Anybody else getting this?

View 2 Replies View Related

Sprint HTC Hero : How To Access Sd Card / Clear Cache?

Dec 19, 2009

how to access sd card and clear cache. I am having a problem were I open e-mail w/ attachment and then it ask's if I want to save to the sd card. So I do and now I can not find the attachment, or when I open it it just prompts to save gain.Thank you for any help.

View 1 Replies View Related

Android :: Why Doesn't Droid Directory Match To Computer Directory

Dec 23, 2009

I have an app that instructed me to copy some data from my computer to the SDCard. So I plugged the Droid into the computer, mounted my Droid SDCard, looked at the directory, and copied the file. There are a bunch of files and folders listed (e.g. backups for apps, album artwork, etc.) as being on the SDCard. But when I go into Astro on the Droid and select "SDCARD" it shows "directory is empty." I don't get it. Why can't I see the folders and files on the SDCard that I can see on the computer screen?

View 3 Replies View Related

Android :: Create Directory Or File Into Data / Local Directory?

Aug 5, 2010

I want to download my apk file into "/data/local/" directory. I am able do this in external storage but unable on "/data/local" also i was trying to create folder on same location but could not do that. Through "adb push" it is possible but i need to do this java program.

View 2 Replies View Related

General :: Saving Video-recordings To Custom Directory On SD Card?

Dec 28, 2013

Is it possible to have my Camera app save recordings (videos) to a custom directory? Currently, the only option I see available is "Save to Phone", or "Save to SD Card".

I'd like to be able to save to my SD Card, however, I'd like for the saved files to not be in the folder "DCIM". I'd like to make a custom directory.

Is this possible? How would I go about achieving this?

My phone is currently rooted.

Samsung Galaxy; Exhibit
SGH-T599N
Complete phone specs: [URL] .....

View 3 Replies View Related

HTC Droid Eris :: Storage - Moving Cache From Phone To Sd Card

Feb 11, 2010

I know i have seen threads for moving cache from phone to sd card but im wondering if it is possibly to move programs at all? my old phone i could do this

View 3 Replies View Related

General :: How To Move Dalvik Cache And Data To SD Card / Ext2

Apr 13, 2012

How can I move dalvik-cache and data/data to sd card or sd ext2?

HTC Explorer A310e

View 9 Replies View Related







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