Append (add) String data to an SD Card text file in an Android application

China☆狼群 提交于 2019-12-06 05:53:01

Change

FileOutputStream fOut = new FileOutputStream(file);

to

FileOutputStream fOut = new FileOutputStream(file, true);

see http://developer.android.com/reference/java/io/FileOutputStream.html#FileOutputStream(java.io.File, boolean)

to do this , u need to read the pre-existing text file and convert it into string.

then append the string.

delete the textfile

write the file at same location.

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