problem with file reading

zxxdaro

Member
Licensed User
Longtime User
Can someone help me solve this problem please.

Here is a piece of code out of a larger chunk. It is the relevant piece.

Sub Activity_Create(FirstTime As Boolean)
Dim Reader As TextReader
Reader.Initialize(File.OpenInput(File.DirInternal,"testandroid.txt"))
Dim line As String
line=Reader.ReadLine
Do While line <> Null

It generates an error message
REader.Initialize(File.OpenInput(File.DirInternal,"testandroid.txt"))
java.io.FileNotFoundException:/data/data/testv1.prog/files/testandroid.txt

I have created the file and everything I have read suggests that it should be readable. Of course as a newbie I am probably making some elementary mistake but I would welcome help in finding the solution.
 

zxxdaro

Member
Licensed User
Longtime User
I created the file as part of the application as advised
I cannot as yet post urls, even urls to this forum! but look up my previous posts
Here is part of the url.
basic4android-updates-questions/12526-creating-files-external-but-part-app.html
 
Upvote 0

zxxdaro

Member
Licensed User
Longtime User
Thank you both for your help. That piece of code now works.
Yes I was aware of the ability to read the file in at one go.
I am following an existing piece of code that I wrote some time ago in Perl and I decided it was best for the moment to translate that code as closely as possible.

It does occur to me that an expanded section on reading this particular kind of files would make a useful addition to the wiki, but I think I should wait a while until I am more familiar with the language before I contribute.

So far I think that Basic4 Android is a far better approach than the java one. I am getting far further much faster.
 
Upvote 0
Top