Android Question Type + asyncstreams + b4xserializator +b4xlib

moster67

Expert
Licensed User
I guess this is strictly not only a B4A-question since it probably applies to B4J and B4i as well.

I am using modified code based on this sample-code (network-asyncstreams-b4xserializator):
https://www.b4x.com/android/forum/threads/b4x-network-asyncstreams-b4xserializator.72149/
and writing a b4xlib (currently only for B4A but will be extended to other B4X platforms).
I am sending images to a B4J-app and I am using the B4X serializator. The images are within a Type-structure because other than images, I am including also other information such as a Name, Size etc. In the future, I might need to add more entries to the Type-structure.

The problem is that since this is a b4xlib, there is no Main-module included and unless the Type is declared in the Main-module, there will be an error when deserializing the data into its corresponding Type in the receiving B4J-app. I am aware of this problem since it was pointed out in the video-tutorial in above link but it has also been mentioned in other posts here in the forum. If I use the class and the service as imported modules in a B4A-project and declaring the Type-object in Main, everything works just fine. However, here since it is a b4xlib, I am not distributing a Main-module.

So I guess my questions are:
1) Is there any way to circumvent this problem?
2) If I skip using Types, can I serialize my (different) data using just an Array of Objects?

Thanks.
 
Last edited:

moster67

Expert
Licensed User
Ok, tested earlier with a Map and it works fine. Will look at this further later.
As to the bitmaps, I am aware of that so I convert the bitmap to bytes and vice versa.
Thank you.
 
Top