I have a temporary file created like this :
File myfile = File.createTempFile(fileName + " - ", suffix, activity.getExternalCacheDir());
FileWriter fw = new FileWriter(file);
CSVWriter writer = new CSVWriter(fw, ' '/* DEFAULT_SEPARATOR */, NO_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER, DEFAULT_LINE_END);
writer.writeNext(entries);
writer.close();
Now, I want to save it to disk at the URL /storage/emulated/0/Android/data/com.example.myproject/files/myfile.csv
So I need to change the URL of myfile and save it to disk with code like this:
FileOutputStream fileOutput = new FileOutputStream(myfile);
// How to change URL of myfile ?
OutputStreamWriter outputStreamWriter=new OutputStreamWriter(fileOutput);
outputStreamWriter.flush();
fileOutput.getFD().sync();
outputStreamWriter.close();
How can I do that ? (= how to change URL and save to disk ?)
Thanks !