Created
March 29, 2019 05:37
-
-
Save alitamoor65/ed73900cee3b6b2e5f98ce00e7c69e4c to your computer and use it in GitHub Desktop.
A method to write into file, append data to new line each time separated by comma in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WriteToFile{ | |
BufferedWriter bw; | |
public void writeFile1(String number){ | |
File fout = new File(Environment.getExternalStorageDirectory() + "/numbers0300.cvs"); | |
FileOutputStream fos = null; | |
try { | |
fos = new FileOutputStream(fout); | |
bw = new BufferedWriter(new OutputStreamWriter(fos)); | |
bw.write(number + ","); | |
Log.i(TAG, "writeFile1: " + number); | |
bw.newLine(); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment