Android Question Get TXT from Server and fill ListView

TechMedia

Member
Licensed User
Longtime User
Hello, i have B4A for a long time, but i really start to look into it now. So, i am a newbie. I need to download a TXT file from a server (using HTTPUtils2) and fill a ListView with the lines of the TXT. Can you help with some code? Thanks a lot in advance
 

TechMedia

Member
Licensed User
Longtime User
I can do the download stuff, my problem is to know how to get the result file and fill the listview with the lines.
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
in the jobDone event you can put something like this - not tested, just a starting point - may be there are more simple ways to do it...:
B4X:
    Dim out As OutputStream = File.OpenOutput(File.DirInternal, "test.txt", False)
    File.Copy2(Job.GetInputStream, out)
    out.Close
    Dim l1 As List
    l1 = File.ReadList(File.DirInternal, "test.txt")
    For i = 0 To l1.size-1
      myListview.AddSingleLine(l1.Get(i))
    Next
 
Upvote 0
Top