Android Question EditText Box and .txt Files

Gavin O'Connor

Member
Licensed User
Hi,

I am a Newbie to the forum and have been playing around a bit and got quite a bit working nicely, right from Date Pickers to spinner boxes etc,

I am having some trouble trying to "Save" data from an edittext box to a .txt file. I have three modules running and was also trying to combine all the edittext boxe's activities together to save them in one big .txt file.

Does anyone have an example of how I can do this?, I have tried the "VB Way" without success,

Any help would be greatly appreciated.
 

Gavin O'Connor

Member
Licensed User
Hi Erel,

Thanks - still a little confused, I tried the above but did not see anything, I also tried

File.Copy("/my documents/","1.txt", "/my documents/", "1.txt")

Which open the My Documents Folder but it does not seem to save the Text File, any ideas there?

Regards,
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I tried the above but did not see anything, I also tried
If you want to see the file with a file manager in the root of the tablet/phone save it to: File.DirRootExternal. This is easier to find:
B4X:
File.WriteString(File.DirRootExternal, "1.txt", EditText1.Text)
or save it to file.DirDefaultExternal (/Android/data/package name/files subfolder). If you did not change the package name, it is probably b4a.example.:
B4X:
File.WriteString(File.DirDefaultExternal, "1.txt", EditText1.Text)
 
Upvote 0

Gavin O'Connor

Member
Licensed User
Brilliant - thanks Erel I have that sorted now and fully understand,

Just another small question how do I combine 3 x edittext boxes from 3 different activities?, I tried the following below which I thought would help

Dim EditText2.Text As EditText (Getting an error, I though it was looking for the IME Library which seems now the case), do you have any ideas?

and wanted to use it in:

File.WriteString(File.DirDefaultExternal, "1.txt", EditText2.Text & Main.edittext1.text)
 
Upvote 0
Top