Hi.
Using HttpUtils.DownloadList and HttpUtils.IsSuccess reports as this is image downloaded OK
In reality got an error:
Completed HttpJob=(ArrayList) [1290684, 1290683, 1290685, 1290680, 1290677, 1290678, 1290681, 1290653, 1290657, 1290652, 1290654, 1290630, 1290628, 1290629, 1290493, 1290631, 1290618, 1290608, 1290658, 1290623]
httputils_getbitmap (B4A line: 96)
b = LoadBitmap(HttpUtilsService.TempFolder, SuccessfulUrls.Get(URL))
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:500)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:491)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:911)
at stuudio.uudishimu.httputils._getbitmap(httputils.java:102)
at stuudio.uudishimu.main._jobdone(main.java:992)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:136)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:120)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:772)
at anywheresoftware.b4a.keywords.Common.CallSub2(Common.java:759)
at stuudio.uudishimu.httputilsservice._processnexttask(httputilsservice.java:241)
at stuudio.uudishimu.httputilsservice._response_streamfinish(httputilsservice.java:342)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:136)
at anywheresoftware.b4a.BA$2.run(BA.java:244)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Error loading bitmap.
HTTP Utils error: java.lang.RuntimeException: Error loading bitmap. Url:http://f.elu24.ee/f/2012/04/17/1060050t12h4953.jpg
Here you see the problematic link to the image. IE9 loads the image OK BTW.
To overcome the problem I modified Http Utile a bit but for sure this is not the perfect way.
May be Erel you can look at the case and create more bulletproof solution.
Thanks
Priit
BTW In the future it would be nice to have some kind of job queue built inside HttpUtils. So user could just add jobs to queue at the time the previous job is not finished yet.
Using HttpUtils.DownloadList and HttpUtils.IsSuccess reports as this is image downloaded OK
In reality got an error:
Completed HttpJob=(ArrayList) [1290684, 1290683, 1290685, 1290680, 1290677, 1290678, 1290681, 1290653, 1290657, 1290652, 1290654, 1290630, 1290628, 1290629, 1290493, 1290631, 1290618, 1290608, 1290658, 1290623]
httputils_getbitmap (B4A line: 96)
b = LoadBitmap(HttpUtilsService.TempFolder, SuccessfulUrls.Get(URL))
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:500)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:491)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:911)
at stuudio.uudishimu.httputils._getbitmap(httputils.java:102)
at stuudio.uudishimu.main._jobdone(main.java:992)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:136)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:120)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:772)
at anywheresoftware.b4a.keywords.Common.CallSub2(Common.java:759)
at stuudio.uudishimu.httputilsservice._processnexttask(httputilsservice.java:241)
at stuudio.uudishimu.httputilsservice._response_streamfinish(httputilsservice.java:342)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:136)
at anywheresoftware.b4a.BA$2.run(BA.java:244)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Error loading bitmap.
HTTP Utils error: java.lang.RuntimeException: Error loading bitmap. Url:http://f.elu24.ee/f/2012/04/17/1060050t12h4953.jpg
Here you see the problematic link to the image. IE9 loads the image OK BTW.
To overcome the problem I modified Http Utile a bit but for sure this is not the perfect way.
B4X:
Sub GetBitmap(URL As String) As Bitmap
Dim b As Bitmap
If IsSuccess(URL) = False Then
Log("Task not completed successfully.")
b.InitializeMutable(10dip, 10dip) ' false initialising a bitmap to return something
Return b
End If
Try
b = LoadBitmap(HttpUtilsService.TempFolder, SuccessfulUrls.Get(URL))
Catch
Log("HTTP Utils error: " & LastException.Message & " Url:" & URL)
b.InitializeMutable(10dip, 10dip) ' false initialising a bitmap to return something
End Try
Return b
End Sub
May be Erel you can look at the case and create more bulletproof solution.
Thanks
Priit
BTW In the future it would be nice to have some kind of job queue built inside HttpUtils. So user could just add jobs to queue at the time the previous job is not finished yet.