I tried it really hard for days, with no success. Please tell me how to download images from web using HttpJob ( HttpUtils2 )
The final result that i am looking for is to download an image from my website to disk ( File.DirRootExternal ).
Code:
Error i get:
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Error occurred on line: 56 (funcoes)
java.io.FileNotFoundException: /data/data/b4a.example/cache: open failed: EISDIR (Is a directory)
at libcore.io.IoBridge.open(IoBridge.java:456)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:498)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1111)
at anywheresoftware.b4a.samples.httputils2.httpjob._getbitmap(httpjob.java:116)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:633)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:298)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:237)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:116)
at anywheresoftware.b4a.BA$3.run(BA.java:319)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.system.ErrnoException: open failed: EISDIR (Is a directory)
at libcore.io.IoBridge.open(IoBridge.java:446)
... 22 more
Ps.: It doesn't matter what i use to catch "GetBitmap", it always will return the same error.
I already tried to delete cache files, remove everything from my celphone linked to the app, etc. No results.
If i just call Job.GetBitmap i will have the same result, wich means there is something wrong in the method itself, calling something weird in the "framework".
Please, any help
The final result that i am looking for is to download an image from my website to disk ( File.DirRootExternal ).
Code:
B4X:
Dim jobPost As HttpJob
jobPost.Initialize("Imagem",Me)
jobPost.Download(imageURL) 'i am using http://techsim.com/ads/img/1PnHmtg5Qy4JU70vwNOJ.jpg
B4X:
Sub JobDone (Job As HttpJob)
If Job.Success = True Then
If Job.JobName="Imagem" Then
Dim img As Bitmap = Job.GetBitmap <---- ERROR
End If
End If
End Sub
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Error occurred on line: 56 (funcoes)
java.io.FileNotFoundException: /data/data/b4a.example/cache: open failed: EISDIR (Is a directory)
at libcore.io.IoBridge.open(IoBridge.java:456)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:498)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1111)
at anywheresoftware.b4a.samples.httputils2.httpjob._getbitmap(httpjob.java:116)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:633)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:298)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:237)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:116)
at anywheresoftware.b4a.BA$3.run(BA.java:319)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.system.ErrnoException: open failed: EISDIR (Is a directory)
at libcore.io.IoBridge.open(IoBridge.java:446)
... 22 more
Ps.: It doesn't matter what i use to catch "GetBitmap", it always will return the same error.
I already tried to delete cache files, remove everything from my celphone linked to the app, etc. No results.
If i just call Job.GetBitmap i will have the same result, wich means there is something wrong in the method itself, calling something weird in the "framework".
Please, any help
Last edited: