It will not work. B4XOrderedMap is a class and class instances cannot be serialized like this. I was confused as the custom map is made of a List and Map which are supported.
If there is a need I will add two new subs that will make it possible to read and write it with B4XSerializator.
Thanks Erel. I was just going to post my test that it did not work either.
B4X:
mp.Initialize
mp.Put("1","test1")
mp.Put("5","test")
mp.Put("2","test2")
mp.Keys.Sort(True)
Dim ser As B4XSerializator
File.WriteBytes(File.DirInternal, "map.dat", ser.ConvertObjectToBytes(mp))
B4X:
Error occurred on line: 34 (Main)
java.lang.RuntimeException: Cannot serialize object: [b4xcollections=null, list=(ArrayList) [1, 2, 5], main=null
, map=(MyMap) {1=test1, 5=test, 2=test2}, starter=null]
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeType(B4XSerializator.java:258)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeObject(B4XSerializator.java:224)
Hey, Manfred: Erel is also human, he seldom makes mistakes, but we have to question him every once in a while. Otherwise the forum becomes a cult. Do you think Erel's products would have reached these heights without the support and contributions from his 100000 members, including a few like, @DonManfred , @klaus , @LucaMs and the list goes on and on.