tags:

views:

24

answers:

2

Hello!

I want to create a file in emulator android storage path /data/...

but it seems I can't create a new file by programs,

I should upload an empty file to /data/... and then write the file,

Can anyone help here?

openFileOutput("file.txt", MODE_PRIVATE) seems can create a new file in /data/data/Package/files/...

but it can't create in path /data/...

Thank you so much !

A: 

You cannot write directly to /data/ folder unless you have a rooted device. If you want to use /data/ directory then I would suggest using

/data/local/tmp/
Maciej Pigulski
A: 

this code can write a new file to the /data/data/Package/files/ folder. May be, the same with your code, but it OK. public void setparameter(int ilevel){ byte[] buffer = new byte[8]; buffer[0] = (byte)ilevel; OutputStream output = null; try{ output = openFileOutput("option.txt", MODE_WORLD_READABLE); output.write(buffer); output.flush(); output.close(); }catch (IOException e) { } }

http://androidstep.blogspot.com/

thanh tien