绝对路径的目录中的android内部存储? [英] absolute path to directory in the internal storage in android?

查看:233
本文介绍了绝对路径的目录中的android内部存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想保持在内部存储的目录里面我的应用程序所需的文件。在previous阶段我用externalStorageDirectory来存储我的数据。
 我现在用下面的code指我的外部目录

I want to keep my app required files inside a directory under internal storage. in the previous stage i used externalStorageDirectory to store my data. now i am using the below code to refer my external directory

 Environment.getExternalStorageDirectory()+"/mydirectory"; 

我需要一个equivalant code是指内部目录中我的目录,任何人可以帮助我...谢谢,

I need an equivalant code to refer my directory in the internal directory, can anybody help me...thanks,

解决方案:

getFilesDir()+"/mydirectory";

感谢您的建议和帮助。

thanks for all of your suggestion and help.

推荐答案

使用 getFilesDir()

文档

返回目录的绝对路径上的文件系统在哪里
  与openFileOutput(字符串,INT)创建的文件的存储位置。

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.

要回答你的评论,我会引用文档文档

To answer your comment, I'll quote the docs docs:

在默认情况下,保存到内部存储器的文件仅对您的
  应用程序和其他应用程序无法访问它们(也可以在
  用户)。当用户卸载应用程序,这些文件是
  删除。

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

这篇关于绝对路径的目录中的android内部存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆