Android Question Simple read http file?

Discussion in 'Android Questions' started by ElliotHC, May 28, 2019.

  1. ElliotHC

    ElliotHC Active Member Licensed User

    Is there a simple read file command? I've had a search around and can't seem to find one.

    I want to point to a web address and send the contents of the file in to an array. http://mydomain.com/Blah.abc > Array


    Thanks
     
  2. DonManfred

    DonManfred Expert Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    Dim lines As List = File.ReadList(...)
    Dim s As String = File.ReadString(...)
     
  4. ElliotHC

    ElliotHC Active Member Licensed User

    Do I put the address in quotes where there is (...)? e.g.

    Dim s As String = File.ReadString("http://mydomain.com/123.ABC")
     
  5. DonManfred

    DonManfred Expert Licensed User

    No. You need to use okhttputils2 to fetch the file from the server and store it to a file in JobDone event.

    The File.* methods only works with local files on your device.

    You can find plenty of examples. Just serch for them
     
  6. ElliotHC

    ElliotHC Active Member Licensed User

    I've got this working nicely now thanks using this.

    (Uses HttpUtils2)

    Code:
    Sub Download (Callback As Object, link As StringAs HttpJob
        
    Dim j As HttpJob
        j.Initialize(
    "", Callback)
        j.Download(
    "http://mydomain.com/123.ABC")
        
    Return j
    End Sub

    Sub Button_Download_Click
        
    Wait For (Download(Me, "http://mydomain.com/123.ABC")) JobDone (j As HttpJob)
        
    If j.Success Then
            
    Log(j.GetString)
        
    End If
        j.Release
    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice