[英]Android: good practices for organizing dirs and files on storage SD card?
我的应用程序存储从Internet下载的资源文件有什么指导吗?
Here is an advice gleaned from the android developers forum: 这是从Android开发者论坛收集的建议:
There are two fairly common and well defined situations:
有两种相当常见且定义明确的情况:
Situation: You need a temp file to do some processing that won't necessarily fit into memory.
情况:您需要一个临时文件来进行一些不一定适合内存的处理。
Solution: Create the file, use it, delete it when you're done* Caveat: The file may be exceptionally large: demand an SDCard.
解决方案:创建文件,使用它,在完成后删除它*警告:文件可能特别大:需要SDCard。 The file contains sensitive information: use app storage.
该文件包含敏感信息:使用应用程序存储。
Situation: You are operating a cache.
情况:您正在运行缓存。
Solution: maintain the files in the supplied cache directory (Context.getCacheDir()), the system knows these can be deleted** Caveat: Big ticket items (like songs and videos) go to the sdcard (the user can treat these types as useful files anyway)
解决方案:将文件保存在提供的缓存目录(Context.getCacheDir())中,系统知道这些文件可以删除**警告:大件物品(如歌曲和视频)转到SD卡(用户可以将这些类型视为反正有用的文件)
为了将来参考,现在已发布指南: http : //developer.android.com/guide/topics/data/data-storage.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.