Android Question Problem with Textwriter

HARRY

Active Member
Licensed User
Longtime User
Im am writing a KML file. When finished I write some closing details and then I close the textwriter:
B4X:
If what =3 Then
        Line= Tab2 & cFolderE
        TextWriter1.WriteLine(Line)
        Line= Tab1 & cFolderE
        TextWriter1.WriteLine(Line)
        Line=cKMLE
        TextWriter1.WriteLine(Line)
        TextWriter1.Close
        KMLOpened=False
    End If

what =3 means finish and close the file.

In debug mode I get an error message on the line TextWriter1.WriteLine(Line)( first one) saying that the textwriter is closed; in release mode the error message says that the textwriter should first be initialized.
In debug mode the file is normally finished; in release mode the file is not visible in the relevant folder. Textwriter1 is no where else closed in the program. Am i doing something wrong?
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
I can't see something wrong here but, of course, you do Initialize it previously ?

B4X:
TextWriter1.Initialize(File.OpenOutput(File.DirDefaultExternal, MyFileName, True))
 
Upvote 0
Top