Android Question Add a text to a txt file

Rodolfo Milan

Member
Licensed User
Hello everyone,
i'm looking on the forum without success, of a method for add a single string to a txt file without read the file, add the line and recreate the entire file.
The file is a simple txt where each line is composed by date.now+barcode and i need to add everytime the new string, but the comand WriteList replace the entire file
 

klaus

Expert
Licensed User
Longtime User
You may have a look at TextWriter and File.OpenOutput.

Example:
B4X:
Private Writer As TextWriter
Writer.Initialize(File.OpenOutput(File.DirInternal, "Test.txt", True))
True means : Append
 
Upvote 0
Top