Hi,
I want to download from a webserver. This works, but after continueing on a message.
Using OkHttpUtils2 v2.61 library
Part of my source:
The log indicates:
The >> CONTINUE = YES << is added by me to indicate the error position and the answer.
After YES the file is correctly saved as you can see.
It seems like a timing problem, but I don't know how to resolve this. Filesize only 60k.
Anybody can help?
Best regards,
André
I want to download from a webserver. This works, but after continueing on a message.
Using OkHttpUtils2 v2.61 library
Part of my source:
B4X:
Sub OphalenLogo
HTTPInlog.JobName="Logo"
HTTPInlog.Download(DownloadUrl)
End Sub
B4X:
If(JobStatus.JobName="Logo") Then
Log(DBFilePath)
Log(HTTPInlog.GetBitmap)
Log("Ja")
If(JobStatus.GetBitmap.Width<>0) Then
' Thats the name of this special download we created using the Tag-Property
Dim OutStream As OutputStream
Log("DownloadReady: "&JobStatus.Tag)
OutStream = File.OpenOutput(DBFilePath, "logo2.jpg", False) ' Job.Tag is read to set the Original Filename we specify earlier in the creation of the Job
JobStatus.GetBitmap.WriteToStream(OutStream,100,"JPEG")
OutStream.Close
Dim InStream As InputStream
InStream = File.OpenInput(DBFilePath,"logo2.jpg")
Log(InStream.BytesAvailable)
InStream.Close
Log("file://"&DBFilePath&"/logo2.jpg")
Log(JobStatus.Tag&" are written to "&DBFilePath) ' Write the Originalname to the log to see what happens ;-)
End If
End If
The log indicates:
B4X:
/mnt/sdcard/CIRIS
main_jobdone (java line: 742)
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:538)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:516)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1315)
at anywheresoftware.b4a.samples.httputils2.httpjob._getbitmap(httpjob.java:165)
at CIRIS.Chauffeur.main._jobdone(main.java:742)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1151)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Error loading bitmap.
>> CONTINUE = YES <<
/mnt/sdcard/CIRIS
(Bitmap): 523 x 198, scale = 1.00
Ja
DownloadReady: java.lang.Object@4107cc68
58864
file:///mnt/sdcard/CIRIS/logo2.jpg
java.lang.Object@4107cc68 are written to /mnt/sdcard/CIRIS
The >> CONTINUE = YES << is added by me to indicate the error position and the answer.
After YES the file is correctly saved as you can see.
It seems like a timing problem, but I don't know how to resolve this. Filesize only 60k.
Anybody can help?
Best regards,
André