I'm trying to access a text file. I saw something similar to this code snippet on the basic4android site:
I've also added the MyTextFile.txt to the files list (accessed in the lower right corner of the screen).
The exception is:
"java.io.FileNotFoundException: mytextfile.txt"
What's the proper way to open a file after checking whether it exists, and what are the relationships between File.DirAssets, File.DirInternal, and any other file on my computer? I've read the definitions of these File-Usage terms, but obviously I do not fully understand them. Where do my own files that I want to use in the App get stored and/or loaded?
Incidentally, I did manage to get this to work in one sample project, but I then tried transferring the code to another project to try to get it to work in your Table example found here:
http://www.b4x.com/forum/additional...class-tableview-supports-tables-any-size.html
I think this Table class will work very well for a word game application I'm just starting.
If I understood the original code, when the file doesn't exist in the DirInternal location, the File.Copy copies the file from the "File.DirAssets" location (wherever that may be) into the "local" "File.DirInternal" directory (wherever that may be). But I don't know why it's not finding my text file.
Does it have anything to do with the paths defined in "Configure Paths"? (although the paths haven't changed from when I worked on the first project to this new project).
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
If File.Exists(File.DirInternal, "MyTextFile.txt") = False Then
File.Copy(File.DirAssets, "MyTextFile.txt", File.DirInternal, "MyTextFile1.txt")
End If
End If
.
.
End Sub
I've also added the MyTextFile.txt to the files list (accessed in the lower right corner of the screen).
The exception is:
"java.io.FileNotFoundException: mytextfile.txt"
What's the proper way to open a file after checking whether it exists, and what are the relationships between File.DirAssets, File.DirInternal, and any other file on my computer? I've read the definitions of these File-Usage terms, but obviously I do not fully understand them. Where do my own files that I want to use in the App get stored and/or loaded?
Incidentally, I did manage to get this to work in one sample project, but I then tried transferring the code to another project to try to get it to work in your Table example found here:
http://www.b4x.com/forum/additional...class-tableview-supports-tables-any-size.html
I think this Table class will work very well for a word game application I'm just starting.
If I understood the original code, when the file doesn't exist in the DirInternal location, the File.Copy copies the file from the "File.DirAssets" location (wherever that may be) into the "local" "File.DirInternal" directory (wherever that may be). But I don't know why it's not finding my text file.
Does it have anything to do with the paths defined in "Configure Paths"? (although the paths haven't changed from when I worked on the first project to this new project).