Android Question How to rcuper text in file.txt from server with httputilis2

ciginfo

Well-Known Member
Licensed User
Longtime User
Hello,
I want to recuper the text (Url) in a file.txt from my server
B4X:
Dim Job1T as HttpJob
job1T.Initialize ("Job1T", Me)
  job1T.Download("http://www.MySite/MyText.txt")'.GetBytes("UTF8")
    UrlTxt_01 = job1T.GetString
It does not work, where is error please? What is the real code?

Thank you
 

KPmaster

Member
Licensed User
Longtime User
This should work:

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim job1T As HttpJob
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    job1T.Initialize("job1T", Me)
    job1T.Download("http://www.MySite.com/MyText.txt")
End Sub

Sub JobDone(Job As HttpJob)
    If Job.Success = True Then
        Msgbox(Job.GetString, "")
    End If   
End Sub
 
Upvote 0
Top