Ok. trying to understand how Android handles downloaded images. So a few questions:
1) Is it possible to download and save an image to the getCacheDir()?
2) Can this image be viewed from the cache directory?
3) If yes to 2), what is the action that will clear up the cache?
4) Must I download the image to somewhere before I can use the ACTION_VIEW intent to view the image?
5) If it is in the cache, how do I "save" it? Meaning put it in a more permanent directory and not the cache.
In summary, I’m trying to achieve user downloads an image from somwhere, sees it in the image viewer and chooses to save it or not.
Currently my understanding on this is I have to download and save it regardless before viewing it on an imageviewer with no choice to save it or not.
If I am wrong what is the approcah to achieve download, view, choose to save?
Ok, from your questions..
1) Yes
2) Yes (I think only for your application.. May be)
3) You have to do it manually, using delete files form
getCacheDir()or either by navigateto
settings/Manage applicationclear cache data option..4) This never tried, but I think you have to do it, (Bco’z I think cacheDir is private for your application)
5) Using File operation copy to another internal / external storage location…
Note:
Returns the absolute path to the application specific cache directory on the filesystem.
These files will be ones that get deleted first when the device runs low on storage. There is no guarantee when these files will be deleted. Note: you should not rely on the system deleting these files for you; you should always have a reasonable maximum, such as 1 MB, for the amount of space you consume with cache files, and prune those files when exceeding that space.