Android Question Problem with downloading TXT file with HttpUtils2

Tomas Petrus

Active Member
Licensed User
Longtime User
Hi,

I have problem with TXT file witch I am downloading from server. File has almost 16 kB, so It is small. I am downloading another file with another type in same project with bigger size (150 kB) and It is without problems. TXT file is not complete. It has 8 kB size and it is cut in half in middle of word.

There is my code:
B4X:
Dim Job As HttpJob
Job.Initialize("DownloadMyFile", Me)
Job.Tag = "file-name.txt"
Job.Download("http://..../file-name.txt")

and this is JobDone code:
B4X:
Case "DownloadMyFile"      
       Dim MyPath = File.dirrootexternal & "/download" As String  
       Dim out As OutputStream = File.OpenOutput(MyPath , Job.Tag, False)
       File.Copy2(Job.GetInputStream, out)

What I am doing wrong? I am using same code for another files with another file type and it is without problems.

Thanks for answer
 

Tomas Petrus

Active Member
Licensed User
Longtime User
It works awesome! Thank you much!

Job.Tag is there because I have function wich is there for more files with diferent name. Name is in Tag
 
Upvote 0
Top