Hello Community,
I am trying to show a picture saved in a column of a SQL Server table using an ImageView.
Here is a sample of the data I retrieve from the database:
This is the code in B4A:
I get the following errors when I try to get the buffer.Length or initialize the InputStream:
Can anybody help me?
I am trying to show a picture saved in a column of a SQL Server table using an ImageView.
Here is a sample of the data I retrieve from the database:
B4X:
[{"kunde_id":26058,"Saison":"20181231","status":0,"vorname":"Hal","name":"****","adresse1":"1354 Main road","plz":"54863","ort":"New J****","Bild":[255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,255,219,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,255,219,0,67,1,9,9,9,12,11,12,24,13,13,24,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,255,192,0,17,8,1,224,1,128,3,1,3...]}]
This is the code in B4A:
B4X:
Dim buffer() As Byte = m.Get("Bild")
Dim b As Bitmap
Dim In As InputStream
Log("Buffer Länge = " & buffer.Length)
In.InitializeFromBytesArray(buffer, 0, buffer.length)
b.Initialize2(In)
ivFoto.Bitmap = b
I get the following errors when I try to get the buffer.Length or initialize the InputStream:
B4X:
Error occurred on line: 353 (Main)
java.lang.IllegalArgumentException: method anywheresoftware.b4a.objects.streams.File$InputStreamWrapper.InitializeFromBytesArray argument 1 has type byte[], got java.util.ArrayList
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:338)
at android.os.Handler.handleCallback(Handler.java:745)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:5454)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Error occurred on line: 352 (Main)
java.lang.RuntimeException: Field: length not found in: java.util.ArrayList
at anywheresoftware.b4a.shell.Shell$FieldCache.getField(Shell.java:908)
at anywheresoftware.b4a.shell.Shell.getField(Shell.java:678)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:338)
at android.os.Handler.handleCallback(Handler.java:745)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:5454)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Can anybody help me?