captain hawak
Member
hi i send image with c# server to b4a tcp client and after get error load bitmap error.
this code very good work for udp just error in tcp from b4a i think problem for tcp b4a
errors:
screen_second_img (java line: 411)
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:539)
at io.hanitum.screen_second._img(screen_second.java:411)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1082)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1037)
at io.hanitum.tcp._astream_newdata(tcp.java:162)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7565)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
java.lang.RuntimeException: Error loading bitmap.
this code very good work for udp just error in tcp from b4a i think problem for tcp b4a
server code c#:
img = Image.FromFile(@"C:\Users\at\Pictures\download.jpeg");
ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Jpeg);
byte[] byteArray = ms.ToArray();
reci = byteArray.Length.ToString();
nwStream.Write(byteArray, 0, byteArray.Length);
client code b4a:
Sub img (buffer() As Byte)
Dim in As InputStream
in.InitializeFromBytesArray(buffer, 0, buffer.Length)
Dim bmp As Bitmap
bmp.Initialize2(in)
Dim bd As BitmapDrawable
bd.Initialize(bmp)
bd.Gravity = Gravity.FILL
Panel3.Background = bd
in.Close
End Sub
errors:
screen_second_img (java line: 411)
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:539)
at io.hanitum.screen_second._img(screen_second.java:411)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1082)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1037)
at io.hanitum.tcp._astream_newdata(tcp.java:162)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7565)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
java.lang.RuntimeException: Error loading bitmap.