Simon Buechner
01/18/2024, 9:27 AMval directory = context.getExternalFilesDir("")
val file = File(directory, fileName)
// If the file does not exist, write the header
if (!file.exists()) {
FileWriter(file).write(header)
FileWriter(file).use { writer ->
writer.write("\n")
}
}
return file
Has anyone a idea what i am doing wrong? I would really appreciate any help. It doesnt have to be persistent when the app is uninstalled, but i want to at least find the file on the device when it is saved.
I have the bad feeling, i need to use SAF and open the document tree to write files that i can use later, but using SAF is cluttering my MainActivity and is not really simple to implement after what i read. Is there no way of just writing a file to a folder that can be accessed by the files app without that much overhead?
Thanks in advance folks.Chrimaeon
01/18/2024, 12:40 PM