1.android four read and write file modes
Context.mode_private: Private mode, overwrite original file contents
Context.mode_append: Append mode, appended to the original file content
Context.mode_world_readable: Ability to read content from other applications
Context.mode_world_writeable: Ability to write content to other applications
If you want other apps to read and write, add 2 context.mode_world_readable + context.mode_world_writeable
FileOutputStream OS = Context.openfileoutput (fileName, module);
Os.write (Content.getbytes ());
Os.close ();
2. Append when other apps write to data
String Path = "/data/data/com.example.demo1/files/rw.txt";
The second parameter, the output stream, is filled in by appending.
FileOutputStream fos = new FileOutputStream (new File (path), true);
Fos.write ("ddddddddd". GetBytes ());
Fos.flush ();
Fos.close ();
Android file read/write API