creating and writing to a file on internal storage

一个人想着一个人 提交于 2019-12-23 03:42:21

问题


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

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.

Question: I want to create and write to a file using the internal storage without rooting the device . Is it possible ?

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

Cant find the file i created on android tablet


回答1:


Use openFileOutput() to create a file:

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.



来源:https://stackoverflow.com/questions/5467161/creating-and-writing-to-a-file-on-internal-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!