Android Question File.ReadString statement didnt bring result

Gbenga Odumosu

Member
Licensed User
Longtime User
hello house,
i have a text file created from my php program and stored in my website. i tried to retrive the content of the file in b4a code with File.ReadString it gave no error but the result is blank. what are mine doing wrongly pls.


my code:


If job2.Success Then

Dim out As OutputStream = File.OpenOutput(File.DirRootExternal,"test.txt", False)
File.Copy2(Job.GetInputStream, out)

EditText1.Text = (File.ReadString(File.DirRootExternal, "test.txt"))

If File.Exists(File.DirRootExternal,"test.txt") = True Then
Msgbox("yes it is available"," ")
' EditText1.Text = "test.txt.text"
paid1 = (File.ReadString(File.DirRootExternal, "test.txt"))
Msgbox(paid1," ")
'paid1 = (File.GetText(File.DirRootExternal, "test.txt"))
Else
Msgbox("i no see am oooo"," ")
End If
out.Close '<------ very important
 

DonManfred

Expert
Licensed User
Longtime User
Please use Code Tags when posting code!

php program and stored in my website
i tried to retrive the content of the file in b4a code with File.ReadString
You can not use File.ReadString with a File not available on your Device.

Use okhttputils2 to retrieve the content and save the content to file then if needed. Or just use the Result you get in yor httpjob Result.
 
Upvote 0

Gbenga Odumosu

Member
Licensed User
Longtime User
Please use Code Tags when posting code!



You can not use File.ReadString with a File not available on your Device.

Use okhttputils2 to retrieve the content and save the content to file then if needed. Or just use the Result you get in yor httpjob Result.
thanks for your response, i appreciate i am new in this b4a what i have done is to first copy the file to my device like this Dim out As OutputStream = File.OpenOutput(File.DirRootExternal,"test.txt", False)
File.Copy2(Job.GetInputStream, out) as tutored by erel
i saw the file in my device but reading it bring out blank result
 
Upvote 0

Gbenga Odumosu

Member
Licensed User
Longtime User
thanks for your response, i appreciate i am new in this b4a what i have done is to first copy the file to my device like this Dim out As OutputStream = File.OpenOutput(File.DirRootExternal,"test.txt", False)
File.Copy2(Job.GetInputStream, out) as tutored by erel
i saw the file in my device but reading it bring out blank result

or please can you assist me on how to do this with sample.
 
Upvote 0
Top