安卓内部存储
我想让一个应用程序能够将文件保存在 SD 卡和设备上(设备上保存的文件必须可供图库和其他应用程序使用)。我应该将这些文件保存在设备上的哪里,以便文件应该公开?应用程序必须支持Android 2.1。谢谢
I want to make an application to be able to save files on sdcard and on device (files saved on device must be available to gallery and other applications). Where should I save these files on device, so files should be public? Application must support Android 2.1. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://developer.android.com/guide/topics/data /data-storage.html#filesExternal
http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
个人认为你应该尽量将内部存储上的文件数量保持在最低限度。通常在手机上,内部存储器非常有限,因此我建议尽量不要在本地保护文件
Personally think you should try to keep the number of files on the internal storage to a minimum. Normally on mobiles, the internal memory is quite limited so I'd recommend to try not to safe files locally
我遇到了同样的问题,我这样解决了:
当外部存储器不可用时(这是我的第一选择),我使用内部存储器并使用 getCacheDir 作为起始路径,这样只有您的应用程序可以访问这些文件。
接下来,当我需要查看图库上的文件时,我使用 contentprovider 来获取对文件的访问权限,看看我写的解决我的问题的答案:
https://stackoverflow.com/a/13935210/1716620
i had your same problem and i solved this way:
when external memory is not available (that's my first choice) ,i use internal memory using getCacheDir as starting path, this way only your application can access those files.
next, when i need to see that files on gallery, i use a contentprovider to obtain access to the file, look at this answer i wrote that solved my problem:
https://stackoverflow.com/a/13935210/1716620