For anyone needing to write and manage temporary files I came across the File deleteOnExit method which deletes the named file when the JVM terminates normally. JavaDoc is here please read it and use with caution. deleteOnExit cannot be removed from the file once set.
Usage example:
Hope it helps.
B4X:
Public Sub RequestDeleteOnExit(FilePath As String)
Dim tFile As JavaObject
tFile.InitializeNewInstance("java.io.File",Array(FilePath))
tFile.RunMethod("deleteOnExit",Null)
End Sub
Usage example:
B4X:
RequestDeleteOnExit(File.Combine(File.DirApp,"dialogclose.css"))
Hope it helps.
Last edited: