【发布时间】:2013-08-16 18:24:49
【问题描述】:
我理解这个问题很相似:What is the difference between getDir and getFilesDir on Android?
但是,当我只想将文件保存在我的私人数据中时,我仍然不确定该使用什么。
对于目录,我应该只使用data/data/com.test.myapp 吗?这会让我的应用程序私有化吗?
// Gets the absolute path to the filesystem directory where your internal files are saved.
getFilesDir()
// Creates (or opens an existing) directory within your internal storage space.
getDir()
我也尝试过阅读一些通用软件开源项目,但我想我对整个 getExternalFilesDir() 更加困惑,因为 Android 没有将内部存储(非 SD 卡)称为“外部" 某个 api 级别之后的存储?
【问题讨论】:
-
getFilesDir() 本质上是 getDir("files")。这是放置应用程序私有数据的好地方。