m4n07
m4n07

Reputation: 2287

creating and writing to a file on internal storage

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

Upvotes: 1

Views: 4047

Answers (1)

Konstantin Burov
Konstantin Burov

Reputation: 69228

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.

Upvotes: 1

Related Questions