I tried this code.
I get the inputstream and tried pass by parse to list and an exception show, but if a put everything in a edit text the donwload I see the text.
How I send to parse the imputstream or I did something incorrectly ?
Thanks for the help
I get the inputstream and tried pass by parse to list and an exception show, but if a put everything in a edit text the donwload I see the text.
How I send to parse the imputstream or I did something incorrectly ?
Thanks for the help
B4X:
'Activity module
Sub Process_Globals
Dim Parser As SaxParser
End Sub
Sub Globals
Dim ListView1 As ListView
Dim EditText1 As EditText
Dim Title,link As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1.bal")
Dim job1, job2, job3 As HttpJob
' job1.Initialize("Job1", Me)
'Send a GET request
' job1.Download2("http://www.b4x.com/print.php", _
' Array As String("first key", "first value :)", "second key", "value 2"))
'Send a POST request
' job2.Initialize("Job2", Me)
' job2.PostString("http://www.b4x.com/print.php", "first key=first value&key2=value2")
'Send a GET request
job3.Initialize("Job3", Me)
'job3.Download("http://www.b4x.com/forum/images/categories/android.png")
job3.Download("http://feeds.feedburner.com/AnimeFreakShowV40Podcast")
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
' Case "Job1", "Job2"
'print the result to the logs
Log(Job.GetString)
Case "Job3"
'show the downloaded image
'Activity.SetBackgroundImage(Job.GetBitmap)
EditText1.Text=(Job.GetString)
addItens(Job.GetInputStream)
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub addItens ( in As InputStream)
ListView1.AddSingleLine("Is started: "&in.IsInitialized)
Parser.Parse(in,"Parse")
in.Close
End Sub
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
If Parser.Parents.IndexOf("channel") > -1 Then
If Name = "title" Then
' Title = Text.ToString
' Else If Name = "link" Then
' link = Text.ToString
' End If
ListView1.AddSingleLine("Teste1")
End If
ListView1.AddSingleLine("Teste2")
End If
If Name = "channel" Then
ListView1.AddSingleLine("Teste3")
'ListView1.AddSingleLine2(Title, link) 'add the title as the text and the link as the value
End If
End Sub