Hey guys
So I solved my problem with downloading a image, But another problem has come up as a result.
I have spent several hours on this and still cant figure it out.
Basiclly, The adress where the pic is located contains { and } and for some reason I cant get the HTTPjob to except those. I have tried with Download2 but cant get that to work. See code below
I have tried using a map and some other stuff but it doesnt seem to be a problem with my code, but more the HTTPJob code.
The error I get looks like this:
Can anybody help me?
Thank you
//
Thestar19
So I solved my problem with downloading a image, But another problem has come up as a result.
I have spent several hours on this and still cant figure it out.
Basiclly, The adress where the pic is located contains { and } and for some reason I cant get the HTTPjob to except those. I have tried with Download2 but cant get that to work. See code below
I have tried using a map and some other stuff but it doesnt seem to be a problem with my code, but more the HTTPJob code.
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("test_first")
try:
image_view_1.Bitmap = LoadBitmap(File.DirRootExternal,"image.jpeg")
catch:
Log("There was a problem with the bitmap finding")
End try
job3.Download2("http://www.novasoftware.se/ImgGen/schedulegenerator.aspx?format=png&schoolid=52550/sv-se&type=1&id=aaaaaC9FBD960-702E-4549-8889-827B5A1EDB85aaaaaa&period=&week=46&mode=0&printer=0&colors=32&head=0&clock=0&foot=0&day=0&width=1883&height=887&maxwidth=1883&maxheight=887",Array As String("aaaaa","[","aaaaaa","]"))
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
Msgbox("Pic downloaded","")
Dim outputstream1 As OutputStream
Dim photo As Bitmap
photo.Initialize3(Job.GetBitmap())
'outputstream1.InitializeToBytesArray(1000)
'photo.WriteToStream(outputstream1,10,"JPEG")
Dim Out As OutputStream = File.OpenOutput(File.DirRootExternal, "image.jpeg", False)
photo.WriteToStream(out, 90, "JPEG")
out.Close
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
The error I get looks like this:
B4X:
java.lang.IllegalArgumentException: Illegal character in query at index 99: http://www.novasoftware.se/ImgGen/schedulegenerator.aspx?format=png&schoolid=52550/sv-se&type=1&id={C9FBD960-702E-4549-8889-827B5A1EDB85}&period=&week=46&mode=0&printer=0&colors=32&head=0&clock=0&foot=0&day=0&width=1883&height=887&maxwidth=1883&maxheight=887
Can anybody help me?
Thank you
//
Thestar19