android - android内部存储中目录的绝对路径?

标签 android directory internal-storage

我想将我的应用程序所需的文件保存在内部存储下的一个目录中。在前一阶段,我使用 externalStorageDirectory 来存储我的数据。 现在我使用下面的代码来引用我的外部目录

 Environment.getExternalStorageDirectory()+"/mydirectory"; 

我需要一个等效的代码来引用我在内部目录中的目录,任何人都可以帮助我...谢谢,

解决方案:

getFilesDir()+"/mydirectory";

感谢您的所有建议和帮助。

最佳答案

为此使用 getFilesDir()

来自docs :

Returns the absolute path to the directory on the filesystem where files created with openFileOutput(String, int) are stored.

No permissions are required to read or write to the returned path, since this path is internal storage.

为了回答您的评论,我将引用文档 docs :

By default, files saved to the internal storage are private to your application and other applications cannot access them (and the user only can access as root). When the user uninstalls your application, these files are removed.

关于android - android内部存储中目录的绝对路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25905649/

相关文章:

android - 如何使我的自定义操作栏透明

java - XmlResourceParser.getText() 在单引号字符后删除文本,忽略双引号

java - BroadcastReceiver中Intent的内容

php - 使用PHP查找文件名中包含字符串或模式的目录中的所有文件

javascript - 获取 HTML 页面调用的 PHP 文件中 HTML 页面的目录

来自内部存储的 Android Intent.ACTION_SEND 和 Content Provider

android - 如何在 Android 设备中找到所有只读存储?

java - 删除操作栏以制作弹出窗口

android - 单击状态通知打开特定文件夹

python - 使用目录 | Python