创建并写入内部存储的文件 [英] creating and writing to a file on internal storage

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

问题描述

我想创建Android平板电脑的文件和一些数据写入。 (只有几个千字节)。

I would like to create a file in android tablet and write some data to it. (only a few kilobytes).

下面的链接有code我想,但我不看到,得到了在/ data目录下创建的文件。有些人说我有我的根设备看到这些文件。

The link below has the code i tried, but i dont see the file that got created in /data directory. some one said i have to root my device for seeing those files.

问:我想创建并使用内部存储,而不生根设备写入一个文件。这可能吗?

我张贴了这个问题,因为我无法找到答案

I'm posting this question as i couldn't find answers for

<一个href=\"http://stackoverflow.com/questions/5458327/cant-find-the-file-i-created-on-android-tablet\">Cant找到我的Andr​​oid平板电脑创建的文件。

推荐答案

使用<一个href=\"http://developer.android.com/intl/zh-TW/reference/android/content/Context.html#openFileOutput%28java.lang.String,%20int%29\"相对=nofollow> openFileOutput()创建一个文件:

FileOutputStream f = openFileOutput("filename", Context.MODE_PRIVATE);
//write to the file stream
f.close();

这通常会创建内部存储设备中的文件,这将是只能由您的应用程序进行访问。

That would normally create a file within internal storage that would be only accessible by your app.

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

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