写私人文件的内部存储 [英] write private file to internal storage

查看:120
本文介绍了写私人文件的内部存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写在内部存储一些文件。

我看到了的FileOutputStream FOS = openFileOutput(文件名,Context.MODE_PRIVATE); 上的数据存储,我明白,该文件将是私有的我的申请。

但问题是它只能打开一个文件没有路径,所以首先我打开了一个新的目录文件,file.mkdir(),但现在,我怎么写文件为私有?


解决方案

  

我看到theFileOutputStream FOS = openFileOutput(文件名,Context.MODE_PRIVATE);在数据存储和我了解,该文件将是私有的我的申请。


正确的。他们将默认为私有的。


  

但问题是它只能打开一个文件没有路径,所以首先我打开了一个新的目录文件,file.mkdir(),但现在,我怎么写文件为私有?


您在子目录创建了你的文件getFilesDir()是私人默认情况下 - 你没有做什么特别的东西,使他们成为私有

I trying to write some files on the internal storage.

I saw theFileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); on Data Storage and I understood that the file will be private to my application.

but the problem is it can only open a file without a path, so first I opened a new directory file with file.mkdir(), but now, how do I write the file as private ?

解决方案

I saw theFileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); on Data Storage and I understood that the file will be private to my application.

Correct. They will be private by default.

but the problem is it can only open a file without a path, so first I opened a new directory file with file.mkdir(), but now, how do I write the file as private ?

Your files that you create in subdirectories off of in getFilesDir() are private by default -- you do not have to do anything special to make them be private.

这篇关于写私人文件的内部存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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