I want my android application to read and write from external files.
I have a button that I want in its action to create (or read from already created file) and read and write from this file
I am using this code
try {
FileWriter fstream = new FileWriter("D:\\DHA\\OnlineConsultationFile\\out.txt\\");
fstream.write("Some String");
fstream.flush();
fstream.close();
}catch (IOException e) {
e.printStackTrace();
}
but it doesn’t write anything on the file.
And then I need to read the content of this file
can anyone help me please ?
Check out the tutorial Reading and Writing a file to SD card sample program in Android from java-samples.com.
Overview from the tutorial: